Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit eb83f6c

Browse files
author
sewardj
committedFeb 23, 2012
Implement malloc_size for the vg_default_zone on Darwin.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12399 a5019735-40e9-0310-863c-91ae7b9d1cf9
1 parent 236a71a commit eb83f6c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed
 

‎coregrind/m_replacemalloc/vg_replace_malloc.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,10 +950,20 @@ static void panic(const char *str)
950950

951951
#if defined(VGO_darwin)
952952

953+
static size_t my_malloc_size ( void* zone, void* ptr )
954+
{
955+
/* Implement "malloc_size" by handing the request through to the
956+
tool's .tl_usable_size method. */
957+
if (!init_done) init();
958+
size_t res = (size_t)VALGRIND_NON_SIMD_CALL1(
959+
info.tl_malloc_usable_size, ptr);
960+
return res;
961+
}
962+
953963
static vki_malloc_zone_t vg_default_zone = {
954964
NULL, // reserved1
955965
NULL, // reserved2
956-
NULL, // GrP fixme: malloc_size
966+
my_malloc_size, // JRS fixme: is this right?
957967
(void*)VG_REPLACE_FUNCTION_EZU(10020,VG_Z_LIBC_SONAME,malloc_zone_malloc),
958968
(void*)VG_REPLACE_FUNCTION_EZU(10060,VG_Z_LIBC_SONAME,malloc_zone_calloc),
959969
(void*)VG_REPLACE_FUNCTION_EZU(10130,VG_Z_LIBC_SONAME,malloc_zone_valloc),

0 commit comments

Comments
 (0)
Please sign in to comment.