6 #include "../memcheck.h"
8 struct super
{ int x
; };
9 static struct super superblock
= { 12345 };
11 /* run with `valgrind -q --malloc-fill=0xaf --free-fill=0xdb` */
12 int main(int argc
, char **argv
)
15 VALGRIND_CREATE_MEMPOOL(&superblock
, /*rzB=*/0, /*is_zeroed=*/0);
20 VALGRIND_MEMPOOL_ALLOC(&superblock
, s
, 40);
21 printf("*s=%#hhx after MEMPOOL_ALLOC\n", *s
);
22 VALGRIND_MEMPOOL_FREE(&superblock
, s
);
23 printf("*s=%#hhx after MEMPOOL_FREE\n", *s
);
24 VALGRIND_MEMPOOL_ALLOC(&superblock
, s
, 40);
25 printf("*s=%#hhx after second MEMPOOL_ALLOC\n", *s
);
27 VALGRIND_DESTROY_MEMPOOL(&superblock
);
33 VALGRIND_MALLOCLIKE_BLOCK(s
, 40, 0/*rzB*/, 0/*is_zeroed*/);
34 printf("*s=%#hhx after MALLOCLIKE_BLOCK\n", *s
);
35 VALGRIND_FREELIKE_BLOCK(s
, 0/*rzB*/);
36 printf("*s=%#hhx after FREELIKE_BLOCK\n", *s
);
37 VALGRIND_MALLOCLIKE_BLOCK(s
, 40, 0/*rzB*/, 0/*is_zeroed*/);
38 printf("*s=%#hhx after second MALLOCLIKE_BLOCK\n", *s
);