Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qml ListView leaks memory on updating view

Qml ListView leaks memory on updating view

Scheduled Pinned Locked Moved Mobile and Embedded
2 Posts 1 Posters 2.4k 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.
  • C Offline
    C Offline
    cladden
    wrote on last edited by
    #1

    With three visible list rows constantly updating text, I see memory increasing (without bound) every time the view is redrawn.

    I'm using the ListView examples provided in the documentation "here":http://doc.qt.digia.com/4.7/qdeclarativemodels.html#c-data-models -I've tried them all.

    As a unit test, I setup a timer for every 100ms that clears all items and then adds three new rows with a timestamp,

    @
    void onTimeout()
    {

    beginResetModel();
    clear();
    endResetModel();

    count++;
    QString str;
    str.sprintf("Item %d", count);

    model->addAnimal(Animal("Wolf", str));
    model->addAnimal(Animal("Polar bear", str));
    model->addAnimal(Animal("Quoll", str));
    }
    @

    I can't have leaks in my application because my model changes completely, and every item (19 items) are always visible.

    Perhaps QPainter is doing some graphics caching and I can disable somehow?

    I'm using Win CE Qt 4.8.4.

    Chris

    1 Reply Last reply
    0
    • C Offline
      C Offline
      cladden
      wrote on last edited by
      #2

      Recall in those examples I used:

      @
      ctxt->setContextProperty("myModel", model);
      @

      Trying to track this one down, in the docs I found "setObjectOwenership":http://apidocs.meego.com/1.2/qt4/qdeclarativeengine.html#setObjectOwnership but I'm not using it.

      However, I tend to think it's a problem with the ListView delegates not garbage collected by the engine.

      I don't understand why the Javascript garbage collector it hanging onto all it's items.

      Chris

      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