ftmemsim-valgrind/massif/tests/malloc_usable.c
Julian Seward ac60633d65 Bug 345248 - add support for Solaris OS in valgrind
Authors of this port:
    Petr Pavlu         setup@dagobah.cz
    Ivo Raisr          ivosh@ivosh.net
    Theo Schlossnagle  theo@omniti.com
            


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15426
2015-07-21 14:44:28 +00:00

22 lines
561 B
C

#include <assert.h>
#include "tests/malloc.h"
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
# if !defined(VGO_darwin) && !defined(VGO_solaris)
// Because our allocations are in multiples of 8 or 16, 99 will round up
// to 104 or 112.
int* x = malloc(99);
// XXX: would be better to have a HAVE_MALLOC_USABLE_SIZE variable here
assert(104 == malloc_usable_size(x) ||
112 == malloc_usable_size(x));
assert( 0 == malloc_usable_size(NULL));
assert( 0 == malloc_usable_size((void*)0xdeadbeef));
# endif
return 0;
}