Jump to content
Sign in to follow this  
Tersion

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  

  • Similar Content

    • By rudi
      Hi.
      The final question first: Is there a reason, that Autoit doesn't clean up RAM usage as a standard feature?
       
      This posting by @guinness was pointing me to the solution for solving my problem:
      https://www.autoitscript.com/forum/topic/131315-accumulating-memory-usage/?do=findComment&comment=914208
      DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", -1) this simple, single line called on a regular basis stopped the script consuming more and more RAM.
      CU, Rudi.
    • By ManualIT
      Guys, i need help on creating a script that restarts a program once it starts using more than 1GB of memory.
      No idea how to start on the script, i don't know which functions i should use for process memory reading.
       
      My mind is in total blank at the moment, so i need a kick start
    • By Pricehacker
      Hello!
      Im wondering if it is possible to 'empty' the variable value to save memory, for example i often use variable as a onetime use thing and would prefer to 'forget' it after is is used
      Maybe it is just as easy as to setting $vVar = Null, but i wanted to make sure that this is the case
    • By CarlD
      Is there a reliable way to ensure that data assigned to variables in a script is overwritten or deleted when the script exits? I have scripts that encrypt/decrypt data and would like to ensure, if possible, that the encryption keys and decrypted data do not stay in memory after the script exits. Thanks.
    • By DynamicRookie
      Hey there!
       
      I've been developing a artificial intelligence.

      My first hard task was letting the A.I know when a sentence is found in memory with different words
      What i tried to do here is simply, get all the words in user sentence that could be used
      as a identifier
              
              example: Steve Jobs
              
              then identify the sentence purpose with the words we found in the past "for" loop
              
              example: Do/Know/You/Who/Steve/Jobs
              
              Compare the example in the following matching sentences in memory.
              
              1-Steve jobs was a known person
              2-Do you know who barack obama is?
              3-Do you know Steve jobs?
              4-Do you know who steve jobs is?
              5-How much money steve jobs had
              
              Then find the sentence that has way more matches than the other ones, remember that if the identifier words were not found
              (Steve jobs) then the sentence is invalid.
              
              Every sentence has a different answer and is important that the right one is chosen.
              
      If there's no more than the half of words in matches, then assign a variable the result of function, such as a return but for a global var.
      I couldn't figure out how to do that with StringRegExp.
       
      I honestly need help with detecting identifiers on memory sentences.
      I would also like to let the AI know typos, meaning that moeny and money means the same thing.
      Any help is hugely appreciated.

       
×
×
  • Create New...