botanic Posted December 31, 2013 Share Posted December 31, 2013 (edited) I have been trying to track down where in my script there is an issue with memory and i was able to track it down to between 2 lines, however it is an "endif"? Please see attached image I have no idea what could possibly cause this... As you can see from the log between "test3" and "test4" there is a consistent 70k ram jump, the only thing between "test3" and "test4" however is an endif... if someone can point me in another direction to look I am totally at a loss and this is causing some major memory issues as i have seen the script get over 2gb of ram as this is a pretty short loop Edited December 31, 2013 by botanic Link to comment Share on other sites More sharing options...
BrewManNH Posted December 31, 2013 Share Posted December 31, 2013 (edited) Actually logprint is inbetween those 2, what does the function logprint look like? EDIT: Oh, and don't post a screenshot, post the actual code. Screenshots are useless. Edited December 31, 2013 by BrewManNH If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
botanic Posted December 31, 2013 Author Share Posted December 31, 2013 (edited) here is the logprint code, whats odd is logprint doesnt cause the problem anywhere else if it is the problem... as you can see in the log the 70k leak only happens at that one point but there is no leak between 2 and 3 etc I usually post code just im at such a loss as to what to even look at Func logprint($text, $nolog = 0, $line = @ScriptName, $name = @ScriptLineNumber) If $nolog Then MsgBox(0, "MyService", $text, 1) Else If Not FileExists($MainLog) Then FileWriteLine($MainLog, "Log created: " & @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC) local $mem = (_getprivbytes(@AutoItPID)/ 1024) & " kb RAM" FileWriteLine($MainLog, @MDAY & "/" & @MON & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & " [" & @AutoItPID & ":" & $line & ":" & $name & ":" & $mem & "] >> " & $text) If Not @Compiled Then ConsoleWrite($text & ":" & $name & @CRLF) EndIf Return 0 ;~ ConsoleWrite($text & @CRLF) EndFunc ;==>logprint Func _getprivbytes ($pid) local $wbemFlagReturnImmediately, $wbemFlagForwardOnly, $colItems, $strComputer, $objWMIService, $colItems $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PerfFormattedData_PerfProc_Process", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems If $pid = $objItem.IDProcess Then Return $objItem.PrivateBytes Next Endif Return 0 EndFunc Edited December 31, 2013 by botanic Link to comment Share on other sites More sharing options...
BrewManNH Posted December 31, 2013 Share Posted December 31, 2013 Privatebytes does not indicate the memory being used by a program, it's more like it's what the program is asking to use, whether it uses that memory or not is another question.http://stackoverflow.com/questions/1984186/what-is-private-bytes-virtual-bytes-working-set If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
botanic Posted December 31, 2013 Author Share Posted December 31, 2013 what is odd is that this increase never stops, so even if it is not actually using it having a process using 2GB of ram in task manager is not really proper Link to comment Share on other sites More sharing options...
trancexx Posted December 31, 2013 Share Posted December 31, 2013 Just small remark about your function. It's better and faster to use WMI's ExecQuery method specifying more complete query so that the API sorts the results for you, than to use basic generic query and loop through collection yourself. What I mean is this: Func _getprivbytes($iPid) Local $sStrComputer = "localhost" Local $oWMIService = ObjGet("winmgmts:\\" & $sStrComputer & "\root\CIMV2") If @error Then Return SetError(1, 0, 0) Return $oWMIService.ExecQuery('SELECT * FROM Win32_PerfFormattedData_PerfProc_Process WHERE IDProcess="' & $iPid & '"').ItemIndex(0).PrivateBytes EndFunc ♡♡♡ . eMyvnE 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