Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
Back to article list Search Articles Add Comment Printer friendly Direct link Par2: Decrease memory useage 2010-07-28 -- Zdravko just will to share simple code which decrease app memory (in my example,
from ~70 MB to ~5 MB)
Also, it decreases most of other running app's (like Iexplore.exe,
Outlook.exe etc.)
It can be done with clean Clarion code, but I'm using ABC free Templates
(Terminate a process part):
(http://www.authord.com/products/Clarion/)
to get all active Process into Queue:
FreeMem ROUTINE
TPLoadProcessesQueue() ! Fill all process into PeQueue
LOOP L = 1 TO RECORDS(PeQue)
GET(PeQue,L)
! You can filter here only your app, like this:
! IF PeQ:szExeFile <> 'your.exe' THEN CYCLE.
! PeQ:szExeFile is lower case
ProcessHandle =
OpenProcess(PROCESS_SET_QUOTA,fInherit,PeQ:th32ProcessID)
X# = SetProcessWorkingSetSize(ProcessHandle,-1,-1)
END
Before that, you need to put this into global embed (Inside the global MAP)
MODULE('WinApi')
SetProcessWorkingSetSize(LONG,LONG,LONG),SIGNED,PASCAL,RAW
END
I'm calling FreeMem routine each 10 min (on event timer)
Today is November 21, 2024, 7:11 am This article has been viewed 35246 times.
|
|