Jump to content

Huge RAM usage with GuiListView.au3 include.


Recommended Posts

Here test example of a dummy program with random added controls to the main form:

Spoiler
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
;#include <GuiListView.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 650, 438, 192, 124)
$Tab1 = GUICtrlCreateTab(5, 5, 604, 423)
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
$Group1 = GUICtrlCreateGroup("Group1", 15, 45, 185, 105)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Group2", 205, 45, 185, 105)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("Group3", 395, 45, 185, 105)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Button1", 15, 155, 75, 25)
$Button2 = GUICtrlCreateButton("Button2", 95, 155, 75, 25)
$Button3 = GUICtrlCreateButton("Button3", 175, 155, 75, 25)
$Input1 = GUICtrlCreateInput("Input1", 15, 185, 121, 21)
$Input2 = GUICtrlCreateInput("Input2", 15, 210, 121, 21)
$Input3 = GUICtrlCreateInput("Input3", 15, 235, 121, 21)
$Input4 = GUICtrlCreateInput("Input4", 140, 185, 121, 21)
$Input5 = GUICtrlCreateInput("Input5", 140, 210, 121, 21)
$Input6 = GUICtrlCreateInput("Input6", 140, 235, 121, 21)
$Edit1 = GUICtrlCreateEdit("", 395, 165, 185, 89)
GUICtrlSetData(-1, "Edit1")
$ListView1 = GUICtrlCreateListView("", 15, 265, 250, 150)
$Label2 = GUICtrlCreateLabel("Label2", 290, 185, 36, 17)
$Label3 = GUICtrlCreateLabel("Label3", 290, 210, 36, 17)
$Label4 = GUICtrlCreateLabel("Label4", 290, 235, 36, 17)
$Label5 = GUICtrlCreateLabel("Label5", 340, 185, 36, 17)
$Label6 = GUICtrlCreateLabel("Label6", 340, 210, 36, 17)
$Label7 = GUICtrlCreateLabel("Label7", 340, 235, 36, 17)
$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")
$Progress1 = GUICtrlCreateProgress(15, 45, 150, 17)
$TabSheet3 = GUICtrlCreateTabItem("TabSheet3")
GUICtrlCreateTabItem("")
$Label1 = GUICtrlCreateLabel("Label1", 45, 10, 36, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

 

If #include <GuiListView.au3> is commented out, then this simple program uses around 3,5 MB of RAM. When #include <GuiListView.au3> NOT commented out - RAM usage is around 13-14 MB.

How can I reduce memory usage? Even if I'm not using GuiListView.au3 - 3,5 MB quite a bit for a such dummy program!

I found out that using this DLLCall in main loop:

DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", -1)

Significantly reduces RAM usage (even with GuiListView.au3 included, from 13-14 MB to 600 KB !!! ) but I'm not sure if it's doesn't have any impact to common workflow of a program...

So, give me any advice about that, please.

Link to comment
Share on other sites

  • Moderators

GUIListView is a large UDF, with well over 100 functions if memory serves. The increase in memory usage is no surprise. I think the bigger question is what kind of poor equipment are you working on that even 13MB of memory usage is a concern? Even the calculator app takes upwards of 18MB.

If you are that concerned, look at AU3Stipper in the SciTE help file. It will strip out all unused functions for you.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

It also probably is affected by the huge number of constants that are added with that one UDF, as it also includes numerous other UDFs and their constants to the size of the script. When compiling, as stated above, just use the AU3Stripper to strip out functions and variables that are used in your script.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

JLogan3o13 and BrewManNH,

Thanks both of you! I used AU3Stipper(I didn't know about that thing) like you mentioned and it's definitely WORKS! With GUIListView.au3 included, RAM usage goes down from 13 MB to 2-3 MB !!!

And JLogan3o13, you mentioned that bigger question is what kind of poor equipment I use that 13 MB of memory usage is concern... I understand your point, but I'm concerned about a bit another thing. I more concerned about comparison of memory usage vs functionality of the app. For my case, app doesn't do anything rather displaying some GUI controls and takes 13 MB of memory. For my point of view, it's waist of memory, even now with availability to have 8 GB or 16 GB of RAM.

And about Calc app which takes upwards of 18 MB. You may say about Windows 10 type of app? Because in my Windows 7 (x64), standard calc.exe in 'Programmer' mode uses ~7 MB of memory. So even there you can see that app (calc.exe) which has enormous functions for its type uses much less memory.

Edited by Tersion
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...