unsigned chunkSizeBytes = 16384;
unsigned maxFreeChunks = 100;
unsigned piecesPerChunk = 13;
- unsigned len = chunkSizeBytes / piecesPerChunk; // Length of the individual block
- unsigned N = maxFreeChunks*piecesPerChunk;
+ unsigned len;
+ unsigned N;
+
+ len = chunkSizeBytes / piecesPerChunk; // Length of the individual block
+ N = maxFreeChunks * piecesPerChunk;
for(unsigned p = 0; p < 5; ++ p) {
d_cmm->push();
- for(unsigned i = 0; i < N; ++i) {
+ for (unsigned i = 0; i < N; ++i)
+ {
char* newMem = (char*)d_cmm->newData(len);
// We only setup the memory in the first run, the others should
// reclaim the same memory
unsigned factor = 3;
N = 16384 / factor;
-
// Push, then allocate, then pop all at once
- for(unsigned p = 0; p < 5; ++ p) {
+ for (unsigned p = 0; p < 5; ++p)
+ {
d_cmm->push();
- for(unsigned i = 1; i < N; ++i) {
- unsigned len = i * factor;
+ for (unsigned i = 1; i < N; ++i)
+ {
+ len = i * factor;
char* newMem = (char*)d_cmm->newData(len);
- for(unsigned k = 0; k < len - 1; k ++) {
+ for (unsigned k = 0; k < len - 1; k++)
+ {
newMem[k] = 'a';
}
- newMem[len-1] = 0;
+ newMem[len - 1] = 0;
TS_ASSERT(strlen(newMem) == len - 1);
}
}