Login
`
Templates, Tools and Utilities
|
||
Icetips Article
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:40 am This article has been viewed 35247 times.
|
|