All pastes #910993 Raw Edit

Someone

public cpp v1 · immutable
·published 2008-02-20 11:59 UTC
rendered paste body
#include <QByteArray>#include <string.h>int main(){    static const char message[] =        "This is the message that is copied around "        "and around. The whole point is that I will "        "create a QByteArray object or a const char* "        "to hold this, then copy it, then delete it.\n"        "No more, no less";    static const int len = sizeof message;    for (int i = 0; i < 1000; ++i) {        char *ptr = new char[len];        memcpy(ptr, message, len);        delete[] ptr;    }    for (int i = 0; i < 1000; ++i) {        QByteArray array(message, len - 1);    }}