Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Monitor system memory / auto-adjust app
Message
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Miscellaneous
Thread ID:
01166915
Message ID:
01166939
Views:
13
>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
Mark, thanks for sharing that! I've got a windows service which processes images and prints them to PDF reports, it does use alot of system resources and this should be a great help.
Dawa Tsering


"Do not let any unwholesome talk come out of your mouths,
but only what is helpful for building others up according to their needs,
that it may benefit those who listen."

- Ephesians 4:29-30 NIV

Dare to Question -- Care to Answer

Time is like water in a sponge, as long as you are willing you can always squeeze some.

--Lu Xun, Father of Modern Chinese Literature

Previous
Next
Reply
Map
View

Click here to load this message in the networking platform