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

20 lines
539 B
C

#include <stdlib.h>
int main(void)
{
int* x = realloc(NULL, 400); // equivalent to malloc(400), and ends up
int* y; // calling Valgrind's (and Massif's) malloc
x = realloc(x, 400); // same size
x = realloc(x, 200); // smaller
x = realloc(x, 600); // bigger
y = realloc(x+10, 800); // bogus realloc
x = realloc(x, 0); // equivalent to free(x), and ends up
// calling Valgrind's (and Massif's) free
return 0;
}