1. Steen Jakobsen
  2. PowerBuilder
  3. Tuesday, 24 May 2022 05:44 AM UTC

Hi,

 

How can I report the amount of FREE memory on the computer from a 64bit pb application. (.exe)

I have tried the below function but it reports 2 GB in 32bit and 0 in 64 bit exe.. any clue ? 

 

Subroutine GlobalMemoryStatus (ref os_memorystatus memorystatus ) Library "KERNEL32.DLL"

 

//Steen

Andreas Mykonios Accepted Answer Pending Moderation
  1. Tuesday, 24 May 2022 07:22 AM UTC
  2. PowerBuilder
  3. # 1

Hi.

If you want to see an example for function Miguel mentioned, you can see how it is implemented in pfc. You should look in pfc_n_cst_plattformunicode. This object uses a structure (object structure) called os_memorystatus. It then declares:

FUNCTION Boolean GlobalMemoryStatusEx(REF os_memoryStatusEx lpBuffer ) LIBRARY "kernel32.DLL"

You can see the result in of_GetFreeMemory and of_GetPhysicalMemory functions.

If you don't have pfc's on your computer you can see this example online in the following link:

2021/pfc_n_cst_platformunicode.sru at master · OpenSourcePFCLibraries/2021 · GitHub

Andreas.

Comment
  1. Steen Jakobsen
  2. Wednesday, 25 May 2022 03:41 AM UTC
Thanks Andreas :-)
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Tuesday, 24 May 2022 06:33 AM UTC
  2. PowerBuilder
  3. # 2
Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 24 May 2022 13:48 PM UTC
  2. PowerBuilder
  3. # 3

Hi Steen;

  Feel free to grab the GlobalMemoryStatusExcommand logic off my free & opensource STD Framework ...

  However, the framework also does a lot more ... for example: memory by Process...

Memory by Window and DataWindow ...

The framework will also notify the App and also the App user when MS-Windows resources get too low where the App is in danger or crashing but, before it crashes (or hangs).   ;-)

HTH

Regards ... Chris

Comment
  1. Steen Jakobsen
  2. Wednesday, 25 May 2022 03:40 AM UTC
Thanks Chris,



That is pretty COOL .. Well done :-)
  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 25 May 2022 13:21 PM UTC
Thanks Steen ... there is A LOT more stuff like this in the framework too, not only tracking each Window & DWO's use and over head but right down to how many times each Menu Item was even selected or clicked. The best thing (IMHO) is its ability to track errors no matter what (network, I/O, DBMS, O/S, PowerScript, OLE, etc) and even allow the app to try continue from these issues. The big bonus (IMHO) is when the app cannot continue (by the App or users response), it tries a "controlled" shutdown logging everything under these situations. Now the production support team can look at the App logging (it also logs to the MS-Windows "debug: and "event" logs) as to exactly what part of the App failed and what the App user was doing before & during the App outage. This gives the team a play-by-play history of the problem scenario. A god send in many production Apps that I have seen in order to recreate (even for the PB Developer) and understand the "whys" of the failure(s).
  1. Helpful
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.