}
-SizeT VG_(arena_payload_szB) ( ArenaId aid, void* ptr )
+SizeT VG_(arena_payload_szB) ( ThreadId tid, ArenaId aid, void* ptr )
{
Arena* a = arenaId_to_ArenaP(aid);
Block* b = get_payload_block(a, ptr);
must be called before any of VG_(malloc) and friends are called. */
extern void VG_(set_client_malloc_redzone_szB) ( SizeT rz_szB );
-extern SizeT VG_(arena_payload_szB) ( ArenaId aid, void* payload );
+extern SizeT VG_(arena_payload_szB) ( ThreadId tid, ArenaId aid, void* p );
extern void VG_(sanity_check_malloc_all) ( void );
void (*tl___builtin_vec_delete)(ThreadId tid, void* p);
void* (*tl_realloc) (ThreadId tid, void* p, SizeT size);
- SizeT (*arena_payload_szB) (ArenaId aid, void* payload);
+ SizeT (*arena_payload_szB) (ThreadId tid, ArenaId aid, void* payload);
Bool clo_trace_malloc;
};
leak-tree.stderr.exp2 leak-tree.stderr.exp64 \
leak-regroot.vgtest leak-regroot.stderr.exp \
leakotron.vgtest leakotron.stdout.exp leakotron.stderr.exp \
+ malloc_usable.stderr.exp malloc_usable.vgtest \
malloc1.stderr.exp malloc1.vgtest \
malloc2.stderr.exp malloc2.vgtest \
malloc3.stderr.exp malloc3.stdout.exp malloc3.vgtest \
doublefree error_counts errs1 exitprog execve execve2 erringfds \
fprw fwrite hello inits inline \
leak-0 leak-cycle leak-tree leak-regroot leakotron \
- malloc1 malloc2 malloc3 manuel1 manuel2 manuel3 \
+ malloc_usable malloc1 malloc2 malloc3 manuel1 manuel2 manuel3 \
match-overrun \
memalign_test memalign2 memcmptest mempool mmaptest \
nanoleak new_nothrow \
--- /dev/null
+#include <assert.h>
+#include <malloc.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+int main(void)
+{
+ // Since our allocations are in multiples of 8, 99 will round up to 104.
+ int* x = malloc(99);
+ assert(104 == malloc_usable_size(x));
+ return 0;
+}
--- /dev/null
+prog: malloc_usable
+vgopts: -q