Saturday, March 28, 2009

cleanMem

#A quick note on the API call itself. This is the same API used by Microsoft in its empty.exe in the Windows 2003 Resource kit. This is also the same api that all .Net programs use by default when you minimize them and their memory lowers. So now instead of being just for .Net, Cleanmem lets you use it on all your programs.

#

http://msdn.microsoft.com/en-us/library/ms682606(VS.85).aspx
EmptyWorkingSet Function
Removes as many pages as possible from the working set of the specified process.

http://msdn.microsoft.com/en-us/library/ms686234(VS.85).aspx
SetProcessWorkingSetSize Function
Sets the minimum and maximum working set sizes for the specified process.

SetProcessWorkingSetSize does force memory to the page file because it limits how much memory the process can have.
EmptyWorkingSet is a cleanup api from Microsoft that doesn’t limit anything it simply removed the unused.

EmptyWorkingSet Function

Removes as many pages as possible from the working set of the specified process.

Syntax

C++

BOOL WINAPI EmptyWorkingSet(
__in HANDLE hProcess
);


Parameters

hProcess [in]

A handle to the process. The handle must have the PROCESS_QUERY_INFORMATION and PROCESS_SET_INFORMATION access rights. For more information, see Process Security and Access Rights.




Return Value


If the function succeeds, the return value is nonzero.



If the function fails, the return value is zero. To get extended error information, call GetLastError.



#Enumerating All Processes



http://msdn.microsoft.com/en-us/library/ms682623(VS.85).aspx



#…



HANDLE hProcess = OpenProcess(  PROCESS_ALL_ACCESS ,

                               FALSE, processID );



# …