>Bernard,
>
>Use the API to release memory at intervals? That sounds interesting! How do I do that? I know how if I have a memory handle but I don't have one. Is there a way to force VFP or Windows to do garbage collection?
>
>Thanks.
>
>Steve
Steve
You may have noticed that after a while your VFP app, especially if doing many SELECTS will use large amounts of memory. This can be see by opening the Task Manager and checking the memory used by the VFP app.
Now you may have also noticed that if you minimize the app. to the taskbar, the memory usage drops to about 2.9 mb. This is VFP doing garbage collection and releasing the memory it has claimed. Even if you Maximize the VFP window you will not use as much memory as you used before.
I use the following code in a timer to run for my unattended processes "just in case"
Declare Integer SetProcessWorkingSetSize In kernel32 As SetProcessWorkingSetSize ;
Integer hProcess , ;
Integer dwMinimumWorkingSetSize , ;
Integer dwMaximumWorkingSetSize
Declare Integer GetCurrentProcess In kernel32 As GetCurrentProcess
nProc = GetCurrentProcess()
bb = SetProcessWorkingSetSize(nProc,-1,-1)
By running this code it is as though you minimizes and then maximized without actually doing it. Just the memory is released. This might help you especially if you have long processes that suck up memory.
You can check this out by running this code from within VFP while watching your memory usage in the task manager.
Enjoy.
Bernard