Search the Community
Showing results for tags 'error allocating memory'.
-
It took a month of cutting down a big program to find it and here's the code to illustrate "Error allocating memory". The first while using the filename in the fileopen, etc. shows the error. The second while example does not have the problem (so I switched to using it). ;shows "Error allocating memory" ;Autoit v3.3.14.5 #AutoIt3Wrapper_run_debug_mode=Y ; use this to debug in console window <--- LOOK #include <FileConstants.au3> ;--- shows error allocating memory - is it Autoit or SciTE ? Try compiling <-- makes no difference so probably not SciTE. Normally error at index 50K-100K $fnINDEX = @ScriptDir & "\__index.txt" $i = 0 ;#cs While 1 $i = $i + 1 FileOpen($fnINDEX, $FO_OVERWRITE) ;overwrite as we just need last one processed FileWriteLine($fnINDEX, $i) FileClose($fnINDEX) If $i/1000 = Int($i/1000) Then MsgBox(0, "count", "$i = " & $i, 1) ;give indication of count, hangs when memory allocation error imminent WEnd ;#ce ;comment out the above loop and this works without an allocation error - looks like the above code leaking memory? While 1 $i = $i + 1 $fh = FileOpen($fnINDEX, $FO_OVERWRITE) ;overwrite as we just need last one processed FileWriteLine($fh, $i) FileClose($fh) If $i/1000 = Int($i/1000) Then MsgBox(0, "count", "$i = " & $i, 1) ;give indication of count WEnd Exit ;program
-
Hello! I am having problem with using file read... Here is my code: #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> Local Const $CHUNK = 1024 Local $hFile = FileOpen(@ScriptDir & '\test.bin', $FO_APPEND) Local $iCurrentPos = 0 Do $iCurrentPos += $CHUNK $bFileSetPos = FileSetPos($hFile, $iCurrentPos, $FILE_END) $vData = FileRead($hFile) $vData = BinaryToString($vData) MsgBox(0, 0, $vData) $iStringPos = StringInStr($vData, "Test", $STR_NOCASESENSEBASIC) Until Not ($iStringPos = 0) Or $bFileSetPos = False FileClose($hFile) MsgBox($MB_OK, "Success", $iStringPos) Here is the 6 MB file: <Attachment Deleted> Thanks in Advance! TD