Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Memory leak under OsX when using overpaint?
Forum Updated to NodeBB v4.3 + New Features

Memory leak under OsX when using overpaint?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 799 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mrioso
    wrote on last edited by
    #1

    Hello QT forum,

    I found a pretty strange behaviour when testing my QT app and discovered the same when testing it with the overpainting example: http://harmattan-dev.nokia.com/docs/library/html/qt4/opengl-overpainting.html

    I tested the application against memory leaks using Instruments, a tool for mac osx.

    1. When I changed the framerate to 60Hz or higher the memory consumption increased linearly by 1Mb / 60 sec
      2 ) Works fine with a lower framerate. This should not be an issue, or what do you think?
      3 ) Anyway, when calling also updateGL(); before calling update() in order to invoke the paintEvent everything works fine again.

    Does anyone have an explanation for this?

    modified the file: opengl/overpainting/glwidget.cpp
    @@
    animationTimer.setSingleShot(false);
    connect(&animationTimer, SIGNAL(timeout()), this, SLOT(animate()));
    animationTimer.start(16); // changed this from 25ms to 16ms. Sould be roughly 60Hz
    @@
    which causes a memory leak.

    However, when adding also updateGL() to the animate function, the memory leak did not occur, ever when beeing updated at 60 Hz:
    @@
    void GLWidget::animate()
    {
    QMutableListIterator<Bubble*> iter(bubbles);

    updateGL();

    while (iter.hasNext()) {
    Bubble *bubble = iter.next();
    bubble->move(rect());
    }
    update();
    }
    @@

    When looking at the call stack it looks to me that under OsX a lot of timer objects (NSTimer) are being created nut not destroyed. This happens within update, so at a level where I cannot call delete or release. It seems, that there is a rate for freeing these objetcs and by running my timer to fast a constant number seems to be left behind in the memory, which could explain the constant increase in memory.

    I hope I could make the problem clear and hope to get some interesting comments on this. Moreover, I hope that some people can save some time chasing down this problem.

    Best regards,
    Reinhard

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Since the problem goes low level, I would recommend that you post this question on the interest mailing list, you'll find there Qt's maintainers/developers (this forum is more user oriented)

      You could also check the "bug report system":http://bugreports.qt-project.org to see whether it's a known issue.

      Adding which version of Qt you are using and which version of OS X would also be helpful

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved