A free memory cleaner for windows is simple.
All the magic happens in 1 single WinApi call(C# interop):
[DllImport(“psapi”)]
private static extern bool EmptyWorkingSet(IntPtr hProcess);
so all you have to do is:
(C# code)
internal class Program
{
[DllImport(“psapi”)]
private static extern bool EmptyWorkingSet(IntPtr hProcess);
private static void Main(string[] args)
{
Clean();
//if u dont want the console to auto close uncomment this line
//Console.ReadLine();
}
private static void Clean()
{
Process[] processes = Process.GetProcesses();
foreach (Process current in
from proc in processes
where proc.ProcessName != “System” && proc.ProcessName != “Idle” && proc.ProcessName != “audiodg”
select proc)
{
try
{
EmptyWorkingSet(current.Handle);
}
catch (Exception ex)
{
//uncomment these lines if u want the errors to be posted in the console
//Console.WriteLine(ex.Message);
}
}
}
}
————————————————————————————————-
So u can download the file here
included in the 7zip file are:
* a pre-compiled exe
* full source code (c# .net/visual studio 2010/.net 4.0)


