Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

AutoIt causes memory leak?

$
0
0
Hey guys,

im writing on my project and got some memory leaks. Actual im looking for the leak for a month and now i got some curios results.

I wrote some testscripts, to see, if AutoIt causes memory leaks. So i wrote some testscript for Listviews, Lists, and Labels to see, if i create a Listview with lets say 1000 items and delete them, does AutoIt reset the complete memory of these items? i'd say no. I did some tests and got the result that in best case 4K memory is missing ...

Testscript #1: Listview created by nature func in combination with UDF funcs to create and delete items.
[ autoit ]         
#include #include #include Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Local $hGUI = GUICreate("GUI", 500, 500) Local $hListview = GUICtrlCreateListView("Column 1", 10, 50, 480, 440) Local $hButton1 = GUICtrlCreateButton("Create 100 Items", 10, 10, 100, 30) Local $hButton2 = GUICtrlCreateButton("Delete All Items", 120, 10, 100, 30) GUISetState(@SW_SHOW, $hGUI) GUICtrlSetOnEvent($hButton1, "_create_items") GUICtrlSetOnEvent($hButton2, "_delall_items") GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") While 1 Sleep(100) WEnd Func _create_items() For $i = 0 To 100 _GUICtrlListView_AddItem($hListview, Random(0, 2000)) Next EndFunc Func _delall_items() _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hListview)) EndFunc Func _exit() Exit EndFunc
Testscript #2: Listview created by UDFfunc in combination with UDF funcs to create and delete items.
[ autoit ]         
#include #include #include Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Local $hGUI = GUICreate("GUI", 500, 500) local $hListview = _GUICtrlListView_Create($hGUI, "Column 1", 10, 50, 480, 440) Local $hButton1 = GUICtrlCreateButton("Create 100 Items", 10, 10, 100, 30) Local $hButton2 = GUICtrlCreateButton("Delete All Items", 120, 10, 100, 30) GUISetState(@SW_SHOW, $hGUI) GUICtrlSetOnEvent($hButton1, "_create_items") GUICtrlSetOnEvent($hButton2, "_delall_items") GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") While 1 Sleep(100) WEnd Func _create_items() For $i = 0 To 100 _GUICtrlListView_AddItem($hListview, Random(0, 2000)) Next EndFunc Func _delall_items() _GUICtrlListView_DeleteAllItems($hListview) EndFunc Func _exit() Exit EndFunc
Testscript #3: Creating a list
[ autoit ]         
#include <GUIConstantsEx.au3> #include <GuiListView.au3> Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Local $hGUI = GUICreate("GUI", 500, 500) Local $hList = GUICtrlCreateList("Column 1", 10, 50, 480, 440) Local $hButton1 = GUICtrlCreateButton("Create 100 Items", 10, 10, 100, 30) Local $hButton2 = GUICtrlCreateButton("Delete All Items", 120, 10, 100, 30) GUISetState(@SW_SHOW, $hGUI) GUICtrlSetOnEvent($hButton1, "_create_items") GUICtrlSetOnEvent($hButton2, "_delall_items") GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") While 1 Sleep(100) WEnd Func _create_items() For $i = 0 To 100 GUICtrlSetData($hList, Random(0, 2000)) Next EndFunc Func _delall_items() GUICtrlSetData($hList, "") EndFunc Func _exit() Exit EndFunc
Testscript #4: Working with labels.
[ autoit ]         
#include #include #include Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Local $hGUI = GUICreate("GUI", 500, 500) Local $hlabel = GUICtrlCreateLabel("AP's: ", 10, 45, 100, 440) Local $hlabel2 = GUICtrlCreateLabel("AP's: ", 110, 45, 100, 440) Local $hlabel3 = GUICtrlCreateLabel("AP's: ", 210, 45, 100, 440) Local $hlabel4 = GUICtrlCreateLabel("AP's: ", 310, 45, 100, 440) Local $hlabel5 = GUICtrlCreateLabel("AP's: ", 410, 45, 100, 440) Local $hButton1 = GUICtrlCreateButton("Create 100 Items", 10, 10, 100, 30) Local $hButton2 = GUICtrlCreateButton("Delete All Items", 120, 10, 100, 30) GUISetState(@SW_SHOW, $hGUI) GUICtrlSetOnEvent($hButton1, "_create_items") GUICtrlSetOnEvent($hButton2, "_delall_items") GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") While 1 Sleep(100) WEnd Func _create_items() Local $sMsg = "" Local $sMsg2 = "" Local $sMsg3 = "" Local $sMsg4 = "" Local $sMsg5 = "" For $i = 0 To 30 $sMsg = $sMsg & Random(1,200) & @CR $sMsg2 = $sMsg2 & Random(1,200) & @CR $sMsg3 = $sMsg3 & Random(1,200) & @CR $sMsg4 = $sMsg4 & Random(1,200) & @CR $sMsg5 = $sMsg5 & Random(1,200) & @CR Next GUICtrlSetData($hlabel, $sMsg) GUICtrlSetData($hlabel2, $sMsg2) GUICtrlSetData($hlabel3, $sMsg3) GUICtrlSetData($hlabel4, $sMsg2) GUICtrlSetData($hlabel5, $sMsg3) EndFunc Func _delall_items() GUICtrlSetData($hlabel, "") GUICtrlSetData($hlabel2, "") GUICtrlSetData($hlabel3, "") GUICtrlSetData($hlabel4, "") GUICtrlSetData($hlabel5, "") EndFunc Func _exit() Exit EndFunc

Got someone a statements for me, if its true?


Regards

Looked up here: http://www.google.com
(Also tried to find out if ShellExecute causes problems) http://www.autoitscript.com/forum/topic/95723-shellexecute-memory-leak/page__hl__memory%20leak#entry688199
http://www.autoitscript.com/forum/topic/88605-delete-selected-listview-items/page__hl__+delete%20+listview%20+item%20+memory#entry636812
http://www.autoitscript.com/forum/topic/132703-correct-way-to-clear-a-listview-solved/
and some more...

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>