C++ (Qt)void * data = malloc(1024 * 1024 * 100); // выделили 100 Mbdata = realloc(data, 1024);
C++ (Qt)#include <QVector> int main (){ const int count = 100 * (1024 * 1024); QVector <int> test; test.resize(count); printf("after resize, press enter\n"); getchar(); test.erase(test.begin(), test.begin() + count - 4); test.squeeze(); printf("after squeeze, press enter\n"); getchar(); test.clear(); printf("after clear, press enter\n"); getchar(); return 0;}
C++ (Qt)#include <QtGUI> int main (){ const int count = 100 * (1024 * 1024); for (int i = 0; i < 100; ++i) { QVector <int> * test = new QVector <int> (); test->resize(count); test->erase(test->begin(), test->begin() + count - 4); test->squeeze(); printf("after squeeze, press enter\n"); getchar(); } return 0;}