Results 1 to 2 of 2

Thread: Increasing memory usage in simple QML application

  1. #1
    Join Date
    Aug 2017
    Qt products

    Question Increasing memory usage in simple QML application

    Hi there,

    I have some problems to understand why my (simplified) logger application increases in memory consumption. I used heaptrack to measure allocations and to track down the source of memory consumption. Closing the application seems to free memory just before closing, so that heaptrack does not show this as a leak.

    The project is quite simple and based on QML with an own class derived by QAbstractTableModel providing the messages to a TableView (Qt 5.9.1, QtQuick 2.0).
    In this test setup, test messages are pushed to the model in a specific frequency. If the maximum number of messages is reached, old messages are discarded.

    Furthermore, I compiled the example using Visual Studio. The memory profiler of VS showed more detailed information. Two screenshots are attached where you can see that QObjectPrivate::Connection and QtPrivate::QSlotObject instances are created by every new message. It seems, they aren't freed if the item gets removed from the model.
    I have no idea, if this is as expected and why this function doesn't (seem to) free memory if rows are deleted.

    Can anyone help me with this? I'd appreciate any suggestions! Thanks!





    Example project zipped:

  2. #2
    Join Date
    Jan 2006
    Warsaw, Poland
    Thanked 5,014 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits

    Default Re: Increasing memory usage in simple QML application

    I don't see any memory leaks. However your code is overly complicated. Your Message class doesn't need to be derived from QObject - it could be a simple struct which would require significantly less memory.

    Please check if you get similar characteristics if you don't use QML but rather display your model on a plain QTableView in the widget world.
    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. Replies: 10
    Last Post: 1st April 2016, 13:30
  2. Memory increasing
    By codeman in forum Qt Quick
    Replies: 2
    Last Post: 4th September 2015, 14:57
  3. Replies: 11
    Last Post: 30th June 2015, 14:19
  4. subwindows in application - memory usage
    By Tomasz in forum Newbie
    Replies: 6
    Last Post: 23rd July 2010, 08:13
  5. Memory usage of simple Qt app
    By DiamonDogX in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2009, 06:53

Tags for this Thread


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.