Results 1 to 5 of 5

Thread: Memory management problem

  1. #1
    Join Date
    Jul 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Memory management problem

    Hello.

    Tried to create(with new) a lot of QSubWindows with some elements and then close and destroy subwindow and its elements( with delete). After this checked memory usage and its still connected to my programm. Checked with valgrind and its seems to be alright but memory usage only increasing with time.I understand this is normal for Qt to not give it back to system. But i would prefer to give it back, or at least avoid this kind of behaviour.Google says its can be avoided if i would go to main event loop periodicaly. But how can it be done?

    Thanks beforehand))

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Memory management problem

    just because the o/s says there is X mb/kb allocated to an app, it does not mean that the app is using it all.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. #3
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Memory management problem

    If you sure that memory management within your application ok (with proper parent hierarchy, and new(s) and delete(s) and valgrind report), then stop worrying about how much memory that system is reporting, it may look like increasing but run it over a considerable time (this depends on your application dynamic object's life cycles)

    Just a trick to try, minimize the Qt application window, and see the memory usage!
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  4. #4
    Join Date
    Jul 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Memory management problem

    Thanks)))I know,you can forget about memory if yours app gets about 20-100 mb. But what if its gets 500 mb when you have 1gb or 512 mb of ram?I tested it with a few examples of the same programm running at the same time. When memory was almost gone,some of alloced to app memory was returned to another process.But everything was working slowly.Thats why i need to control how much memory its geting from system.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Memory management problem

    Quote Originally Posted by zloigall View Post
    Thanks)))I know,you can forget about memory if yours app gets about 20-100 mb. But what if its gets 500 mb when you have 1gb or 512 mb of ram?
    The system will reclaim memory if it is needed for something else. "Free" memory is wasted memory.

    But everything was working slowly.Thats why i need to control how much memory its geting from system.
    You do that by configuring the system properly.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Memory management in Qt?
    By wookoon in forum Qt Programming
    Replies: 7
    Last Post: 6th November 2010, 18:20
  2. QEvent memory management
    By staser12 in forum Qt Programming
    Replies: 2
    Last Post: 24th August 2010, 08:41
  3. Memory Management Reg
    By BalaQT in forum Newbie
    Replies: 10
    Last Post: 4th February 2010, 12:43
  4. Memory management
    By cyberboy in forum Qt Programming
    Replies: 2
    Last Post: 12th June 2008, 20:48
  5. Memory management in QT
    By Gayathri in forum Qt Programming
    Replies: 1
    Last Post: 17th November 2006, 07:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.