to a conceptually better place.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13546
return arena;
}
-SizeT VG_(malloc_effective_client_redzone_size)(void)
-{
- vg_assert(VG_(needs).malloc_replacement);
- ensure_mm_init (VG_AR_CLIENT);
- /* ensure_mm_init will call arena_init if not yet done.
- This then ensures that the arena redzone size is properly
- initialised. */
- return arenaId_to_ArenaP(VG_AR_CLIENT)->rz_szB;
-}
-
// Initialise an arena. rz_szB is the (default) minimum redzone size;
// It might be overriden by VG_(clo_redzone_size) or VG_(clo_core_redzone_size).
// it might be made bigger to ensure that VG_MIN_MALLOC_SZB is observed.
mi->keepcost = 0; // may want some value in here
}
+SizeT VG_(arena_redzone_size) ( ArenaId aid )
+{
+ ensure_mm_init (VG_AR_CLIENT);
+ /* ensure_mm_init will call arena_init if not yet done.
+ This then ensures that the arena redzone size is properly
+ initialised. */
+ return arenaId_to_ArenaP(aid)->rz_szB;
+}
/*------------------------------------------------------------*/
/*--- Services layered on top of malloc/free. ---*/
#include "pub_core_basics.h"
#include "pub_core_libcbase.h"
#include "pub_core_libcprint.h"
+#include "pub_core_libcassert.h"
+#include "pub_core_tooliface.h" // VG_(needs)
#include "pub_core_mallocfree.h"
#include "pub_core_options.h"
#include "pub_core_replacemalloc.h"
return True;
}
+SizeT VG_(malloc_effective_client_redzone_size)(void)
+{
+ vg_assert(VG_(needs).malloc_replacement);
+
+ return VG_(arena_redzone_size)(VG_AR_CLIENT);
+}
+
/*------------------------------------------------------------*/
/*--- Useful functions ---*/
/*------------------------------------------------------------*/
extern SizeT VG_(arena_malloc_usable_size) ( ArenaId aid, void* payload );
+extern SizeT VG_(arena_redzone_size) ( ArenaId aid );
+
extern void VG_(mallinfo) ( ThreadId tid, struct vg_mallinfo* mi );
// VG_(arena_perm_malloc) is for permanent allocation of small blocks.
// possibly some more due to rounding up.
extern SizeT VG_(malloc_usable_size)( void* p );
-
-// If tool is replacing malloc for the client, the below returns
-// the effective client redzone as derived from the default
-// provided by the tool, VG_(clo_redzone_size) and the minimum
-// redzone required by m_mallocfree.c.
-// It is an error to call this before VG_(needs_malloc_replacement) has
-// been called.
-extern SizeT VG_(malloc_effective_client_redzone_size)(void);
-
// TODO: move somewhere else
// Call here to bomb the system when out of memory (mmap anon fails)
__attribute__((noreturn))
extern Bool VG_(replacement_malloc_process_cmd_line_option) ( const HChar* arg );
+// If tool is replacing malloc for the client, the below returns
+// the effective client redzone as derived from the default
+// provided by the tool, VG_(clo_redzone_size) and the minimum
+// redzone required by m_mallocfree.c.
+// It is an error to call this before VG_(needs_malloc_replacement) has
+// been called.
+extern SizeT VG_(malloc_effective_client_redzone_size)(void);
+
#endif // __PUB_TOOL_REPLACEMALLOC_H
/*--------------------------------------------------------------------*/