Qml ListView leaks memory on updating view
-
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
-
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