I decided to make a very simple test.
It allocates a QVector, then it shows a message so that you can test memory usage, then the vector is deleted and you can test again memory usage.
In my system, both VmRss and VmSize do not change (actually just some KB).
Please, tell me if I'm doing something wrong!
#include <QtGui>
int main(int argc, char *argv[]) {
// Memory allocation
QVector<double> *vector = new QVector<double>;
vector->resize(10000);
QMessageBox::information(0,
"Memory Allocation Test",
"Memory allocated");
// Memory deletion
vector->clear();
vector->squeeze();
delete vector;
QMessageBox::information(0,
"Memory Allocation Test",
"Memory deleted");
return 0;
}
#include <QtGui>
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
// Memory allocation
QVector<double> *vector = new QVector<double>;
vector->resize(10000);
QMessageBox::information(0, "Memory Allocation Test", "Memory allocated");
// Memory deletion
vector->clear();
vector->squeeze();
delete vector;
QMessageBox::information(0, "Memory Allocation Test", "Memory deleted");
return 0;
}
To copy to clipboard, switch view to plain text mode
Bookmarks