Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Monitor system memory / auto-adjust app
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Title:
Monitor system memory / auto-adjust app
Miscellaneous
Thread ID:
01166915
Message ID:
01166915
Views:
56
This message has been marked as the solution to the initial question of the thread.
Here's a diddy I wrote that some VFP developers who use a lot of images in their app might find helpful. This checks percent of total physical memory in use and does a CLEAR RESOURCES if your passed-in percentage is exceeded. Because of the extensive caching that VFP does with images, it helps your VFP app be a better neighbor.
PROCEDURE CheckAdjustMemory
LPARAMETERS PctMax
LOCAL  cBuffer
DECLARE GlobalMemoryStatus IN Kernel32 STRING @ lpBuffer
cBuffer = REPLICATE(CHR(0),32)
=GlobalMemoryStatus(@cBuffer)
* Percent of memory usage; 1st byte of 2nd DWord
IF ASC(SUBSTR(cbuffer,5)) > PctMax  
  CLEAR RESOURCES 
ENDIF
RETURN
Next
Reply
Map
View

Click here to load this message in the networking platform