1. GUSTAVO MARCELINO
  2. PowerBuilder
  3. Saturday, 11 April 2020 22:38 PM UTC

I need to do Multithread to run a process in the background and then return to the user. But I realized that every time I call Thread the system is not freeing it from memory. I created an EMPTY UserObject to test, and then used the following code to test on a 0.1 second timer:

///////////////

string ls_nm_thread

ls_nm_thread = "thread_" + is_cd_mercado + "_orders_" + String(Now(), 'dd-mm-yyyy_hh:mm:ss.fff')

SharedObjectRegister("n_shared", ls_nm_thread)
SharedObjectGet(ls_nm_thread, ln_shared)
SharedObjectUnRegister(ls_nm_thread)

//////////////

This code is not calling any function to execute, I just realized that the problem is when registering the thread that the memory keeps going up. I've tried using GarbageCollect () below but it doesn't work either.

Any idea?

Yiannis Papadomichelakis Accepted Answer Pending Moderation
  1. Sunday, 12 April 2020 13:00 PM UTC
  2. PowerBuilder
  3. # 1

Unfortunately Appeon abandoned the shared objects.There is no officially support on this.

If your scenario is to create multiple threads, in order to speedup a calculation, then you are screwed.  I tried too hard using PB threads and now I use them only when I want to make http requests that will take longer than expected. My approach is to create only one thread for the entire application and all windows use the same thread.

 

 

Comment
There are no comments made yet.
Ricardo Colarina Accepted Answer Pending Moderation
  1. Thursday, 16 April 2020 06:35 AM UTC
  2. PowerBuilder
  3. # 2

How about SetProcessWorkingSetSize?  I forgot exactly how I called the API but in a previous job, I do recall it freeing up used memory in a similar issue to yours.

Comment
There are no comments made yet.
  • Page :
  • 1


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