GetMemorySize = function (exefile) {// read the memory size used by the program in the process import process GetProcessMemoryInfo =: Psapi. api ("GetProcessMemoryInfo", "int (pointer hProcess, struct & ppsmemCounters, int cb)") PROCESS_MEMORY_COUNTERS = class {int cb; int PageFaultCount; int PeakWorkingSetSize; // maximum value of physical memory int WorkingSetSize; // the size of physical memory int worker; int QuotaPagedPoolUsage; int worker; int QuotaNonPagedPoolUsage; int PagefileUsage; // the size of virtual memory int PeakPagefileUsage; // maximum virtual memory} mem = PROCESS_MEMORY_COUNTERS () for processEntry in process. each (exefile) {prc = process (processEntry. th32ProcessID) try {GetProcessMemoryInfo (prc. handle, mem, raw. sizeof (mem) io. print (processEntry. szExeFile + "memory usage:", mem. workingSetSize/1024 + + "K") }}} io. open () getMemorySize (". *. exe ")