INTERNET APPLICATION DEVELOPMENT
MID MARKET ERP DEVELOPMENT
by Jacky Xu
Recently, we had a VB6 program that always was running to scan a specific folder, get files to process, and print a report. A timer control triggers this logic. The program uses Sage 300 ERP COM API to print the report. But the program cannot release memory immediately after we set the COM object to zero. So, the memory of the program will grow to be very large. We had to find a solution to release the memory after each file processing. We realized we could call windows API “EmptyWorkingSet” to release the memory immediately. (Note: Mini OS requirement of the API is Windows XP or Windows 2003) Below are some sample codes:
When the program starts, we can get the current process handler.
After calling the processing function, we can call the API to release the memory immediately.
And there you have it the problem was solved!
Pingback from scoop.it
CodePartners Blog | How to Release Memory Immed...http://www.scoop.it/t/sage-300-erp/p/4022500013/2014/06/04/codepartners-blog-how-to-release-memory-immediately-for-vb6