Files
ftmemsim-valgrind/massif/tests/basic.c
Nicholas Nethercote d95559802b Changed Massif to record the 'slop' heap bytes caused by rounding asked-for
sizes up to a multiple of 8 (or whatever --alignment is).  This is combined
with the "admin" bytes, resulting in the "extra" bytes.  Added
VG_(malloc_usable_size) to the tool interface to support this.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7133
2007-11-10 04:08:08 +00:00

22 lines
410 B
C

#include <stdlib.h>
// Allocate some memory and then deallocate it, to get a nice up-then-down
// graph.
int main(void)
{
// N=36 gives us 72 snapshots, which fills the text graph nicely.
#define N 36
int i;
int* a[N];
for (i = 0; i < N; i++) {
a[i] = malloc(200); // 200 is divisible by 8 -- so no slop.
}
for (i = 0; i < N-1; i++) {
free(a[i]);
}
return 0;
}