Modify

Opened 11 years ago

Closed 11 years ago

#2498 closed Bug (No Bug)

High Memory Consumption

Reported by: Tasiro Owned by:
Milestone: Component: AutoIt
Version: 3.3.9.21 Severity: None
Keywords: memory, nested array Cc:

Description

Const $fill_size = 2 ^ 24 ; change should be visible in task manager

Func test ()
	Local $arr [$fill_size]
	MsgBox (0, "", "Ready?")
	$arr [0] = $arr
	MsgBox (0, "1/2 times", "Ready?")
	$arr [1] = $arr
	MsgBox (0, "2/3 times", "Ready?")
	$arr [2] = $arr
	MsgBox (0, "3/4 times", "Ready?")
	$arr [3] = $arr
	MsgBox (0, "4/5 times", "Ready?")
	$arr [4] = $arr
	MsgBox (0, "5/6 times", "Ready?")
	Return $arr
EndFunc

Func test2 ()
	Local $arr [$fill_size]
	MsgBox (0, "", "Ready?")
EndFunc

MsgBox (0, "", "Start" & @CRLF & "- open the task manager")
test2 ()
MsgBox (0, "", "Free")
test ()
MsgBox (0, "", "End")

Memory usage differs between v3.3.9.21 and v3.3.8.1. (v3.3.9.21 with GC?)

Why is so much memory consumed? When exactly was something copied? When assigning a value? When returning a value? When passing a value as an argument? When not? Please update the documentation.

Attachments (0)

Change History (6)

comment:1 Changed 11 years ago by BrewManNH

I don't see much difference in memory usage between 3.3.9.21 and 3.3.8.1, there's a slight difference on my computer, but not a whole lot.

If you're asking why it uses so much memory in the second test, it's because you keep putting the array into itself, every time you do that you're going to use a LOT of memory. I'm not sure what exactly the issue you're complaining about is, maybe you should write it out more clearly explaining EXACTLY what you think is wrong.

comment:2 Changed 11 years ago by Tasiro

There is a difference of 66 MB after the execution of line 6.

Why does it need memory to copy a pointer? No memory is consumed in the statement $arr [0] = $arr (v3.3.8.1).

comment:3 Changed 11 years ago by BrewManNH

Who says it's copying a pointer? It's copying the contents of the array $arr into element 0 of $arr so in effect you've just doubled the memory needed to hold $arr. Doing it again into element 1 means you now need to triple the memory needed to hold $arr and so on and so on.

comment:4 Changed 11 years ago by Tasiro

Const $size = 2 ^ 24

Func test ()
    Local $arr [$size]
    MsgBox (0, "", "1")
    $arr [0] = $arr
    MsgBox (0, "", "2")
    $arr [1] = $arr
    MsgBox (0, "", "3")
    $arr [2] = 1
    MsgBox (0, "", "4")
    $arr [3] = 2
    MsgBox (0, "", "5")
    $arr [4] = $arr
    MsgBox (0, "", "6")
    $arr [5] = 3
    MsgBox (0, "", "7")
EndFunc

test ()

AutoIt 3.3.8.1

message box memory change operation
1 69.912 KB +69.912 KBDim $arr [$size]
2 69.928 KB +16 KB$arr [0] = $arr
3 135.600 KB +65.672 KB$arr [1] = $arr
4 201.268 KB +65.668 KB$arr [2] = 1
5 201.268 KB +0 KB$arr [3] = 2
6 201.268 KB +0 KB$arr [4] = $arr
7 266.936 KB +65.668 KB$arr [5] = 3

Well, I think this behavior is strange. Why is the memory allocation delayed?

comment:5 Changed 11 years ago by jchd18

Trac is for reporting confirmed bugs, not asking for implementation details you "think" are strange.
FYI, AutoIt uses COW.

comment:6 Changed 11 years ago by Jos

  • Resolution set to No Bug
  • Status changed from new to closed

Please discuss in our forums and only report confirmed bug here.

Cheers,
Jos

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

Action
as closed The ticket will remain with no owner.
Author


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

 
Note: See TracTickets for help on using tickets.