jftuga Posted July 9, 2005 Share Posted July 9, 2005 I have this code in a larger program:$ProgramName="test123" Global $TopWin = GUICreate($ProgramName, ....) Global $Handle = WinGetHandle($ProgramName) Dim $v_dll = "Kernel32.dll" DllCall($v_dll, 'int', 'SetProcessWorkingSetSize', 'hwnd', $Handle, -1, -1 )I then compile the script to a .exe This should reduce the memory footprint of the running AutoIt-Compiled process, but it does not. I am not familiar with DllCall, but suspect that $Handle is not right.Here is the info on the SetProcessWorkingSetSize()http://msdn.microsoft.com/library/default....kingsetsize.aspAlternatively, I could use EmptyWorkingSet() which uses psapi.dll, but could not get it to work either.http://msdn.microsoft.com/library/default....yworkingset.aspAny ideas on how to get this working would be greatly appreciated.Thanks,-John Admin_Popup, show computer info or launch shellRemote Manager, facilitates connecting to RDP / VNCProc_Watch, reprioritize cpu intensive processesUDF: _ini_to_dict, transforms ini file entries into variablesUDF: monitor_resolutions, returns resolutions of multiple monitorsReport Computer Problem, for your IT help deskProfile Fixer, fixes a 'missing' AD user profile Link to comment Share on other sites More sharing options...
w0uter Posted July 9, 2005 Share Posted July 9, 2005 (edited) AFAIK.handle should be from an OpenProcess call.you can get one from my memory functions. (see my sig)also you dllcall syntax is wrong. it should be something LIKE:DllCall($v_dll, 'int', 'SetProcessWorkingSetSize', 'long', $Handle, 'long', -1, 'long', -1 ) Edited July 9, 2005 by w0uter My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
jftuga Posted July 9, 2005 Author Share Posted July 9, 2005 Thanks, I will give this a try. I assume you are talking the link to "mem stuff". -John Admin_Popup, show computer info or launch shellRemote Manager, facilitates connecting to RDP / VNCProc_Watch, reprioritize cpu intensive processesUDF: _ini_to_dict, transforms ini file entries into variablesUDF: monitor_resolutions, returns resolutions of multiple monitorsReport Computer Problem, for your IT help deskProfile Fixer, fixes a 'missing' AD user profile Link to comment Share on other sites More sharing options...
jftuga Posted July 9, 2005 Author Share Posted July 9, 2005 No luck. I tried this: Global $Handle = _MemOpen($MEM_W, False, ProcessExists('Remote_Manager.exe')) ; and MEM_R, MEM_O Dim $rc = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $Handle) Also this: Dim $rc = DllCall("Kernel32.dll", 'int', 'SetProcessWorkingSetSize', 'long', $Handle, 'long', -1, 'long', -1 ) Any other ideas? -John Admin_Popup, show computer info or launch shellRemote Manager, facilitates connecting to RDP / VNCProc_Watch, reprioritize cpu intensive processesUDF: _ini_to_dict, transforms ini file entries into variablesUDF: monitor_resolutions, returns resolutions of multiple monitorsReport Computer Problem, for your IT help deskProfile Fixer, fixes a 'missing' AD user profile Link to comment Share on other sites More sharing options...
w0uter Posted July 9, 2005 Share Posted July 9, 2005 (edited) you had insufficent access. this works for me. Global Const $PROCESS_ALL_ACCESS = 0x1f0fff Global Const $PROCESS_CREATE_PROCESS = 128 Global Const $PROCESS_CREATE_THREAD = 2 Global Const $PROCESS_DUP_HANDLE = 64 Global Const $PROCESS_QUERY_INFORMATION = 1024 Global Const $PROCESS_SET_INFORMATION = 512 Global Const $PROCESS_TERMINATE = 1 Global Const $PROCESS_VM_OPERATION = 8 Global Const $PROCESS_VM_READ = 16 Global Const $PROCESS_VM_WRITE = 32 Global $Handle = _MemOpen($PROCESS_ALL_ACCESS, False, $PID) Dim $rc = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $Handle) Func _MemOpen($i_dwDesiredAccess, $i_bInheritHandle, $i_dwProcessId) $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', $i_dwDesiredAccess, 'int', $i_bInheritHandle, 'int', $i_dwProcessId) If @error Then SetError(1) Return 0 EndIf Return $ai_Handle[0] EndFunc;==> _MemOpen() Edited July 9, 2005 by w0uter My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
jftuga Posted July 9, 2005 Author Share Posted July 9, 2005 (edited) Awesome. This totally works. Maybe you could add this to your mem.au3? Before using the DllCall, my program used 4036 KB of memory and after using it is used 1688 KB -- a difference of 2348 KB (59% less memory). I do not see any difference in performance, either. -John Edited July 9, 2005 by jftuga Admin_Popup, show computer info or launch shellRemote Manager, facilitates connecting to RDP / VNCProc_Watch, reprioritize cpu intensive processesUDF: _ini_to_dict, transforms ini file entries into variablesUDF: monitor_resolutions, returns resolutions of multiple monitorsReport Computer Problem, for your IT help deskProfile Fixer, fixes a 'missing' AD user profile Link to comment Share on other sites More sharing options...
jftuga Posted July 10, 2005 Author Share Posted July 10, 2005 I posted a _ReduceMemory() UDF here.Thanks w0uter!-John Admin_Popup, show computer info or launch shellRemote Manager, facilitates connecting to RDP / VNCProc_Watch, reprioritize cpu intensive processesUDF: _ini_to_dict, transforms ini file entries into variablesUDF: monitor_resolutions, returns resolutions of multiple monitorsReport Computer Problem, for your IT help deskProfile Fixer, fixes a 'missing' AD user profile Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now