1. Konstantin Goldobin
  2. PowerBuilder
  3. Friday, 1 April 2022 15:24 PM UTC

Hello,

It is said that a process running in 32 bit Windows can consume up to 2 GB of memory. In my experience, a PB application crashes when it is approaches 1 GB. For example, the following script fails with a runtime error "Not enough memory to execute the operation" on the 10th iteration, and the Windows Task Manager shows that PB is taking up only about 930 MB at the moment of the crash:

string mem[]
int i

do
	i++
	mem[i] = space(1024*1024*50)
loop until 2 = messageBox( 'Info', 'Added ' + string( 50*i) + ' MB. Continue?', question!, yesNo!)

Could somebody explain why? I tried this with PB2019 R3 build 2728.

Konstantin Goldobin Accepted Answer Pending Moderation
  1. Friday, 8 April 2022 08:06 AM UTC
  2. PowerBuilder
  3. # 1

Thanks for the 4gb_patch hint! Has anyone patched the PB EXE itself? Or is the only way to benefit from patching is always building EXEs?

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Thursday, 7 April 2022 23:20 PM UTC
  2. PowerBuilder
  3. # 2

Based on a previous response in this forum, I have started running the 4gb_patch.exe against every EXE that I create.

To be faire, we seldom experienced memory issues, but on the rare occasion the app would abend based on a memory issue. Since I started using this patch, this has not (yet) occurred!

The patch is available here:   https://ntcore.com/?page_id=371



Later -

Olan

Comment
  1. Steen Jakobsen
  2. Friday, 8 April 2022 04:27 AM UTC
We previously used the 4gb_patch (before we migrated to x64) and it WORKS great. It gives you up to 3 GB before the app crashes.

In may cases this is enough. - I can highly recommend it.



//Steen
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 7 April 2022 15:21 PM UTC
  2. PowerBuilder
  3. # 3

Hi Konstantin;

  FYI: My STD Framework captures all of this within the App & Logs it automatically. You can even set "thresholds" and the framework will warn the App user before the App crashes on low resources. It also tracks resources used for Menu & DWO's as well. For example:

Memory_Threshold=50
Memory_Use=Y
Memory_Warn=Y

Regards ... Chris

Comment
There are no comments made yet.
Konstantin Goldobin Accepted Answer Pending Moderation
  1. Thursday, 7 April 2022 10:17 AM UTC
  2. PowerBuilder
  3. # 4

Thank you all! Are you saying that Windows Task Manager does not display the amount of memory taken up by the PB VM and other related DLLs?

Comment
  1. Miguel Leeuwe
  2. Thursday, 7 April 2022 14:20 PM UTC
No, what I'm saying is, that you cannot assume that all of the "available memory on windows" will automatically be available to Powerbuilder at any moment. Powerbuilder takes bits of it and assigns it to its "own memory heap" and works with that heap.

regards
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 1 April 2022 17:03 PM UTC
  2. PowerBuilder
  3. # 5

Powerbuilder does not consume directly the available memory in windows. PB allocates memory on "its own heap" and rather arbitrarily. So you can run out of memory before really reaching that supposed 2GB limit.

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 1 April 2022 16:47 PM UTC
  2. PowerBuilder
  3. # 6

The 2GB limit is the size of a Windows user mode address space. The 2GB of virtual memory is used not just for temporary storage of values (variables), but also application code, including all of the runtime DLL's that are loaded at a particular moment (pbvm.dll, pbdwe.dll, etc.), database drivers (both the PB interface dll's and the vendor-specific dll's), the communications buffer(s) they utilize, and I suspect a whole lot more that is needed "under the covers" in support of an executing application.

Suffice to say that I'm not surprised you cannot utilize the full 2GB of virtual memory with your app, but I am a little surprised that the effective limit appears to be approximately 1GB.

Armeen is correct in stating that if your app requires more, you will likely need to migrate to producing a 64-bit PB application. If you've have never done so before, I strongly suggest you carefully review the migration guide:

https://docs.appeon.com/pb2021/migrating_32bit_applications_to_64bit/header-n5.html

Regards, John

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Friday, 1 April 2022 16:33 PM UTC
  2. PowerBuilder
  3. # 7

The memory taken up by the PowerBuilder Runtime DLL files counts against the 2 GB limit.

Comment
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Friday, 1 April 2022 15:39 PM UTC
  2. PowerBuilder
  3. # 8

I can't tell you the reason why, but we ran into same problem with a heavy JavaScript app running in Chrome.  When we got around 1.2GB Chrome would crash.  Seems Windows doesn't like 32-bit process to consume that much memory.  You can try to migrate your app to 64-bit and see if that helps because 64-bit will give the app more memory headroom.  

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.