Can you create a standalone example? (I see no calls to your create/uncreate)
How are you measuring memory consumption? Elvis Den tors 2 nov. 2023 16:52Nuno Santos <nuno.san...@imaginando.pt> skrev: > Hi, > > I have realised that I cannot release all the memory allocated by a huge > QJsonObject when I don’t need it any more. To ensure that nothing else was > in between I have created a simple program that does what is below. > Conclusion: > > - Running on a Mac, compiled in release with Qt 6.5.3 > > - Starts with 31.7 MB > > [image: Screenshot 2023-11-02 at 15.48.29.png] > > - Goes up to 412.5 MB > > [image: Screenshot 2023-11-02 at 15.48.43.png] > > - After calling uncreate drops to 42.7 > > [image: Screenshot 2023-11-02 at 15.48.50.png] > > > If I repeat this procedure, it always increases the process memory size > although it is not linear. > > In iOS the problem is even worse. > > Any ideas of what is happening here? > > Thank you! > > Best regards, > > Nuno > > > QString GetRandomString() > { > const QString > possibleCharacters("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); > const int randomStringLength = 4096; // assuming you want random > strings of 12 characters > > QString randomString; > for(int i=0; i<randomStringLength; ++i) > { > int index = QRandomGenerator::global()->generate() % > possibleCharacters.length(); > QChar nextChar = possibleCharacters.at(index); > randomString.append(nextChar); > } > > return randomString; > } > > void Controller::create() > { > qDebug() << Q_FUNC_INFO; > > for (int i=0; i<100000; i++) > _data[QString::number(i)] = GetRandomString(); > } > > void Controller::uncreate() > { > qDebug() << Q_FUNC_INFO; > > _data = QJsonObject(); > } > > > _______________________________________________ > Interest mailing list > Interest@qt-project.org > https://lists.qt-project.org/listinfo/interest >
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest