Fzz Posted June 26, 2007 Share Posted June 26, 2007 Looking for some help on this. I have a chat bot that watches a log file for new entries. If the line is directed towards the bot it is acted on. This technique of FileReadLine() in a loop to watch the end of a file being written to has worked for me for a long time. Since the latest version I've been leaking memory to a max of 2 gig in about 2 hours. Here is an extremely over simplified version of the bot to demonstrate the leak. Normally I loop every 1/4 second but in this example I've sped it up for full effect. ; Leak example ; ; Create empty file for this test. $tmpFile=FileOpen("MyChatLog.txt",2) FileClose($tmpFile) Sleep(1000) ; Open File for reading $theLog=FileOpen("MyChatLog.txt",0) ; Watch for additions to the end of the file While 1 $NewData=FileReadLine($theLog) if $NewData<>"" then ParseData() EndIf Sleep(10) WEnd Func ParseData() If StringInStr($NewData,"hi") Then MsgBox(0,"","Hi to you too!") EndIf EndFunc You can watch with your favorite process manager as autoit chews through the memory. Thanks for anyone who can help me with this. Fz Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 26, 2007 Moderators Share Posted June 26, 2007 Must be something on your PC, that has 0% CPU usage for me. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Fzz Posted June 26, 2007 Author Share Posted June 26, 2007 Must be something on your PC, that has 0% CPU usage for me.Yep...shouldn't use much CPU. How about the RAM? Link to comment Share on other sites More sharing options...
herewasplato Posted June 26, 2007 Share Posted June 26, 2007 Yep...shouldn't use much CPU. How about the RAM?Yep - it eats about 2MB/sec. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Siao Posted June 26, 2007 Share Posted June 26, 2007 (edited) It seems to me that example using AutoIt3A doesn't leak, only Unicode version does. Edit: Also it seems that if the txt file is in Unicode format, Unicode AutoIt doesn't leak either. So maybe it has something to do with ANSI-to-UTF conversion it does. Edited June 26, 2007 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
Fzz Posted June 26, 2007 Author Share Posted June 26, 2007 It seems to me that example using AutoIt3A doesn't leak, only Unicode version does.Edit:Also it seems that if the txt file is in Unicode format, Unicode AutoIt doesn't leak either.So maybe it has something to do with ANSI-to-UTF conversion it does.Wow, good find. That will certainly get my bot back in business. Timmy bot thanks you!And me too. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 26, 2007 Moderators Share Posted June 26, 2007 Yep...shouldn't use much CPU. How about the RAM?It seems to me that example using AutoIt3A doesn't leak, only Unicode version does.Edit:Also it seems that if the txt file is in Unicode format, Unicode AutoIt doesn't leak either.So maybe it has something to do with ANSI-to-UTF conversion it does.Yes... Quickly looked, and didn't look at your actual post concern... Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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