1. Steen Jakobsen
  2. PowerBuilder
  3. Monday, 27 November 2017

Hi all,

 

The code below is eating up memory. (This example is eating 50 MB in 3 minutes)

GarbageGollect() does not work

 

The only 2 solutions are:

1. destroy and create datastore

2. MyDataStore.DataObject = "some dw"     and then  myDataStore.SetTransObject(MyTransaction)

But this is just not possible in our application.

What can I do ? (I'm in deep trouble)

Thanks in advance 

// Steen

-----------------------------

DataStore lds
lds = Create DataStore
lds.DataObject = "d_abc"
lds.SetTransobject(SQLCA)
 
int li_x
long ll_f
For li_x = 1 To 500
    lds.Retrieve('some id')
    For ll_f = 1 To lds.RowCount()  // 700 rows
         lds.SetItem(ll_f,"mycolname",'some data') // memory leak here!!
    Next
Next
MessageBox("","before destroy")
Destroy lds
 
// memory released
 
----------------------------
Chris Pollach Accepted Answer Pending Moderation
0
Votes
Undo

Hi Steen;

    Can you try the following ....

  1. Create a PB.INI file in your App's work folder
  2. Add the following to the INI ...

[DataStore Behavior]
UseHwnd=no

Let me know if that helps!

Regards ... Chris

 

Comment
Hi Dan;



      Basically, this stops the PBVM from allocating very expensive control blocks and MS-Window handles for DataStores. The PBVM treats the DS like a DW Control and thinks that you might make it visible at some point - so it allocates graphic resources for the DS. The above setting tells the PBVM to ignore creating these resources as the DS will never be visible. So not only do you save MS-Window resources, it also makes your PB Apps run much faster where DS use is concerned.



    BTW: This fix goes way back to the PowerSoft days of PB 7 / 8.



Regards ... Chris



 

  1. Chris Pollach
  2. Tuesday, 28 November 2017
Hi Chris,



Can the DataStore object still print if it has no Windows handles? /Michael

  1. Michael Kramer
  2. Tuesday, 28 November 2017
Hi Michael;



  A great question and ... Yes, it can!  



Regards ... Chris

  1. Chris Pollach
  2. Tuesday, 28 November 2017
There are no comments made yet.
  1. Monday, 27 November 2017
  2. PowerBuilder
  3. # 1
Roland Smith Accepted Answer Pending Moderation
0
Votes
Undo

Try getting the rowcount into a long first instead of having it part of the For statement.

Comment
There are no comments made yet.
  1. Monday, 27 November 2017
  2. PowerBuilder
  3. # 2
Govinda Lopez Accepted Answer Pending Moderation
0
Votes
Undo

Hi Steen,


Based on your example code, I infer that, you are using a nested "FOR" because you are doing some more processing in it. But, if this wasn't the case, I would suggest to fill that column in the query during the RETRIEVE. (ie: SELECT a, b, mycolname = 'some data' FROM mytable WHERE a BETWEEN 1 AND 500). That way you may be able to avoid the use of a FOR cycle of 350,000 iterations.

On the other hand, if you find that a particular part of the function is causing this, then I would recommend you open a support ticket for this case. It may be something with the internal processing of the info.

I hope this helps and please do share your results here.


Regards,

Comment
Hi Govinda,



Thanks for your quick reply :-)



 



The sample code is a simple way to repro the issue.



The application has 5000 objects and cannot be easily rewritten to workaround the bug.



using the sample code the issue is 100% visible. To my mind a huge memory management bug.



I will open a ticket. ;-)



 



Thanks - Steen



 

  1. Steen Jakobsen
  2. Monday, 27 November 2017
Thank you Steen,



 



I will review your ticket. Meanwhile, have you used this on other PowerBuilder versions as well? If so, did this happen there too?



 



 



Regards,

  1. Govinda Lopez
  2. Monday, 27 November 2017
There are no comments made yet.
  1. Monday, 27 November 2017
  2. PowerBuilder
  3. # 3
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.