` Decrease memory useage ( Zdravko ) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

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 April 23, 2024, 5:39 pm
This article has been viewed 35117 times.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: