Custom Query

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (148 - 150 of 3866)

Ticket Resolution Summary Owner Reporter
#1565 Fixed Arrays as object properties; memory leak Jon trancexx
Description

If arrays are used with objects as e.g. properties some sort of memory leak occurs. This seems to be specific only to Array type. Example (monitor memory usage during execution):

$a = StringSplit("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z", ",")

MsgBox(0, "", "start")
For $count = 0 To 10000
	$obj = ObjCreate("Scripting.Dictionary")
	$obj.add("test", $a)
	$obj = 0
Next
MsgBox(0, "", "stop")

For possible comparisons, VBS version would be:

a = Split("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z", ",")
 
MsgBox("start")
For count = 0 to 10000
    Set obj=CreateObject("Scripting.Dictionary")
    obj.add "test", a
    Set obj = Nothing
Next
MsgBox("stop")

No leak there (or with some other languages).

#1566 Fixed Array as its own element issue trancexx trancexx
Description

Code is:

#include <Array.au3>

Global $a[3] = [1, 2, 3]
$a[1] = $a

; And then
$b = $a[1]
$c = $b[1]
$d = $c[1]
$e = $d[1]
$f = $e[1]
;...
_ArrayDisplay($a, "Displaying $a")
_ArrayDisplay($b, "Displaying $b")
_ArrayDisplay($c, "Displaying $c")
_ArrayDisplay($d, "Displaying $d")
_ArrayDisplay($e, "Displaying $e")
_ArrayDisplay($f, "Displaying $f")

If array (old) is put as some element of its own endless* recursion occurs. Expected would be $b to be 1, 2, 3. Obvious workaround works as expected.

I tried to determine how deep it goes but my RAM was sucked up. 10000 here:

#AutoIt3Wrapper_Run_Au3check=n

	Global $0[3] = [1, 2, 3]
	$0[1] = $0

	$iMax = 10000 ; Probably 16000000 / 3 is the max
	For $i = 1 To $iMax
	Assign($i, Execute("$" & $i - 1 & "[1]"))
	Next
	_ArrayDisplay(Eval($iMax), "Displaying $" & $iMax)

If this is combined with Ticket #1565 AutoIt crashes (stack overflow).

$a = StringSplit("ab", "")
$a[1] = $a

$obj=ObjCreate("Scripting.Dictionary")
MsgBox(64, "", "It will crash now")
$obj.add("test", $a)
#1655 No Bug GUICtrlSetImage issue on static controls trancexx
Description

This function causes a memory leak (GDI objects) in combination with STM_SETIMAGE or STM_SETICON messages send directly to the control. Seems this function destroys images assigned only by a previous call to itself (or those set when creating the control). If some image is set with GUICtrlSendMsg it won't be destroyed. I guess there is nothing wrong with that logic except it's, in described situation, setting new image without destroying the old one, therefore incrementing overall GDI Objects count only because it's not aware of the already assigned image. More proper would be to destroy previously assigned image regardless of how it's set.

This can be concluded by carefully(!) examining the effects of e.g. this code:

#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)


Global $hIconNew, $hIconOld

Global $hGUI = GUICreate("GUICtrlCreateIcon")

GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
Global $hIcoControl = GUICtrlCreateIcon("", "", 20, 75, 32, 32) ; no icon
GUISetState()




While 1

	$hIconNew = _GetIcon("shell32.dll", 8, 32)
	ConsoleWrite("$hIconNew = " & $hIconNew & @CRLF)
	;GUICtrlSendMsg($hIco, 368, $hIcon, 0) ; STM_SETICON version, or:
	$hIconOld = GUICtrlSendMsg($hIcoControl, 370, 1, $hIconNew) ; STM_SETIMAGE
	ConsoleWrite("$hOld = " & Ptr($hIconOld) & @CRLF)
	; _WinAPI_DestroyIcon($hIconOld) ; I can omit this because GUICtrlSetImage will do it for me on the next call

	Sleep(700)

	;_WinAPI_DestroyIcon(GUICtrlSendMsg($hIcoControl, 369, 0, 0)) ; STM_GETICON. Ommiting this on the other hand causes a leak
	; Btw, that's the same as:
	;_WinAPI_DestroyIcon($hIconNew)

	ConsoleWrite("Assigned icon before GUICtrlSetImage = " & Ptr(GUICtrlSendMsg($hIcoControl, 369, 0, 0)) & @CRLF) ; STM_GETICON
	ConsoleWrite("GUICtrlSetImage returns " & GUICtrlSetImage($hIcoControl, "shell32.dll", 5) & @CRLF)
	ConsoleWrite("Assigned icon after GUICtrlSetImage = " & Ptr(GUICtrlSendMsg($hIcoControl, 369, 0, 0)) & @CRLF) ; STM_GETICON

	ConsoleWrite(@CRLF)

	Sleep(700)

WEnd



Func _GetIcon($sModule, $iName, $iSize) ; for loaded modules
	Local $hModule = _WinAPI_GetModuleHandle($sModule)
	If @error Then Return SetError(1, 0, 0)
	Local $hIcon = _WinAPI_LoadImage($hModule, $iName, 1, $iSize, $iSize, 0) ; IMAGE_ICON, LR_DEFAULTCOLOR
	If @error Then Return SetError(2, 0, 0)
	Return $hIcon
EndFunc   ;==>_GetIcon

Func _Quit()
	Exit
EndFunc   ;==>_Quit

GDI Objects count can be monitored with task manager.

Note: See TracQuery for help on using queries.