Opened 10 years ago

Closed 10 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: Severity: None
Keywords: Cc:


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>

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]
	$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 &= ");"
	;_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

Attachments (0)

Change History (4)

comment:1 Changed 10 years ago by anonymous

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

comment:2 Changed 10 years ago by anonymous

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?


comment:3 Changed 10 years ago by anonymous

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 Changed 10 years ago by Jos

  • Resolution set to No Bug
  • Status changed from new to 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.


Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

as closed The ticket will remain with no owner.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.