Opened 12 years ago
Closed 12 years ago
#2808 closed Bug (No Bug)
Some memory leek issue with assigning value to variable
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | 3.3.10.2 | Severity: | None |
| Keywords: | Cc: |
Description
I'm get strange issue with assigning value to variable -
if it $sSqlBuild_Query = ""; > i'm get constantly growing WorkingSetSize
if it $sSqlBuild_Query = 0; > WorkingSetSize is behaving as expected
see reproduser :
#include <Array.au3>
#include <File.au3>
SomeRecursion()
;
;==============================================================================================
Func SomeRecursion()
$fl = _FileListToArrayRec("C:\","*",1,1,0,2)
Dim $aSomeArray[$fl[0]+1][3]
$aSomeArray[0][0] = $fl[0]
For $i = 1 To $aSomeArray[0][0]
$aSomeArray[$i][0] = $fl[$i]
$aSomeArray[$i][1] = Random(1,100000000,1)
$aSomeArray[$i][2] = $fl[$i]
Next
;----------------------------------------------------------------------------------------------
$sSqlBuild_Table = '(RSSXMLItem,getfrom,EPOCH,Title)'
$sSqlBuild_Query = ""
For $i = 1 To $aSomeArray[0][0]
$sSqlBuild_Query &= 'INSERT INTO SomeArrayDB ' & $sSqlBuild_Table & ' VALUES '
$sSqlBuild_Query &= "('" & StringReplace( $aSomeArray[$i][0], "'", "''", 0, 1) & "'"
$sSqlBuild_Query &= ",'HTML'"
$sSqlBuild_Query &= ",strftime('%s','" & StringReplace( $aSomeArray[$i][1], "'", "''", 0, 1) & "')"
$sSqlBuild_Query &= ",lower('" & StringReplace( $aSomeArray[$i][2], "'", "''", 0, 1) & "')"
$sSqlBuild_Query &= ");"
Next
;_SQLite_Exec($SomeArrayDB, $sSqlBuild_Query )
;----------------------------------------------------------------------------------------------
$fl = 0
$aSomeArray = 0
$sSqlBuild_Table = 0
;----------------------------------------------------------------------------------------------
$sSqlBuild_Query = "";<<<<<<<<<<<<<<< change value to 0 and memory leek is gone
;----------------------------------------------------------------------------------------------
$aMemory = ProcessGetStats ( )
If IsArray($aMemory) Then
$Q = MsgBox(4096+1, "", "WorkingSetSize: " & $aMemory[0]/1024/1024 & @CRLF & "PeakWorkingSetSize: " & $aMemory[1]/1024/1024,2)
If $Q = 2 Then Exit
EndIf
SomeRecursion()
EndFunc
;==============================================================================================
Attachments (0)
Change History (4)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Your script seems to only keep on recursing deeper and never return a level up, so how do you determine there is a memory leak?
Jos
comment:3 by , 12 years ago
My script trying to clean up data in the end of every cycle, but failing because assigning value of blank string to the variable do not deletes previous/garbage data from memory. Working Set Size constantly grow, so after some time, it get bigger than 2 Gb and memory allocation error will be thrown out. In my case it was about 300Mb "steps", so crash happen way faster than in reproducer.
comment:4 by , 12 years ago
| Resolution: | → No Bug |
|---|---|
| Status: | new → closed |
Setting a variable to "" doesn't mean the memory is freed.
The whole purpose of recursing is that the scripts returns to each recursion and continues with what it was doing with a variables still intact.
Please hop over to the forum and discuss this there.
I am closing his as no bug for now.
Jos

I'd be guessing here, but I'd say it's because one way is declaring a string and the other is numeric.