QML memory leaks while using Text elements



  • All greetings. I have problem with memory leaks in QML on win xp sp2. I use my .qml file in C++ code through QDeclarativeView object.

    My .qml file:
    @
    import Qt 4.8

    Image
    {
    id: background
    source: "login-background.png"
    anchors.verticalCenter: parent.verticalCenter
    anchors.horizontalCenter: parent.horizontalCenter

    width: 720
    height: 576

    Text
    {
    id: textLabel
    text: "Hello from login form"
    font.bold: true
    color: "red"
    font.pointSize: 20
    font.family: "Helvetica"
    anchors.left: parent.left
    anchors.top: parent.top
    }
    }
    @
    My C++ function that loads and shows this .qml file:
    @
    int main(int argc, char* argv[])
    {

    _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );

    QApplication app( argc, argv );

    QWidget mainFrame;

    mainFrame.setFixedSize(720, 576);
    mainFrame.show();

    QDeclarativeView *view = new QDeclarativeView(&mainFrame;);

    view->setCacheMode(QGraphicsView::CacheNone);
    view->setSource( QUrl::fromLocalFile("LoginForm.qml"));
    view->show();
    view->deleteLater();

    return app.exec();
    }
    @
    After deleting QDeclarativeView object i wait for some time while garbage collector collects all created elements data. Image element data is collected ok after 15 seconds. But Text element data is not collected by garbage collector and causes memory leaks.

    Debug Info:
    @
    Detected memory leaks!
    Dumping objects ->
    {12690} normal block at 0x032B7838, 1040 bytes long.
    Data: < > 01 00 00 00 00 01 00 00 00 01 00 00 CD CD CD CD
    {12689} normal block at 0x032BE028, 8192 bytes long.
    Data: < > FF FF FF FF 00 BF FF EE 9F 00 00 00 00 00 00 00
    {12687} normal block at 0x032B7750, 88 bytes long.
    Data: < > 01 00 00 00 00 01 00 00 20 00 00 00 08 00 00 00
    {12685} normal block at 0x032C3370, 40 bytes long.
    Data: < |+ R R > A8 7C 2B 03 00 52 00 00 52 00 00 00 00 00 00 00
    {12683} normal block at 0x032C32A0, 40 bytes long.
    Data: < |+ Q Q > A8 7C 2B 03 00 51 00 00 51 00 00 00 00 00 00 00
    {12681} normal block at 0x032C31D0, 40 bytes long.
    Data: < |+ P P > A8 7C 2B 03 00 50 00 00 50 00 00 00 00 00 00 00
    {12679} normal block at 0x032C3100, 40 bytes long.
    Data: < |+ O O > A8 7C 2B 03 00 4F 00 00 4F 00 00 00 00 00 00 00
    {12677} normal block at 0x032C3030, 40 bytes long.
    Data: < |+ + + > A8 7C 2B 03 00 2B 00 00 2B 00 00 00 00 00 00 00
    {12675} normal block at 0x032B8278, 40 bytes long.
    Data: < |+ L L > A8 7C 2B 03 00 4C 00 00 4C 00 00 00 00 00 00 00
    .......................................................................................................
    @

    If i delete Text element from my .qml file everything is ok, and there are no memory leaks. Can someone advise me the decision of this problem? Also would like to add that i have the same problem when i use TextInput qml element


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.