Index: base/allocator/allocator_shim_default_dispatch_to_glibc.cc |
diff --git a/base/allocator/allocator_shim_default_dispatch_to_glibc.cc b/base/allocator/allocator_shim_default_dispatch_to_glibc.cc |
index 02facbad2eb7cff333e4f9ab6a78b5cffeb52632..a946c36894e220eea7e39b52a006b7ca27cb6d6e 100644 |
--- a/base/allocator/allocator_shim_default_dispatch_to_glibc.cc |
+++ b/base/allocator/allocator_shim_default_dispatch_to_glibc.cc |
@@ -14,6 +14,7 @@ void* __libc_calloc(size_t n, size_t size); |
void* __libc_realloc(void* address, size_t size); |
void* __libc_memalign(size_t alignment, size_t size); |
void __libc_free(void* ptr); |
+size_t __malloc_usable_size(void* ptr); |
Primiano Tucci (use gerrit)
2016/08/24 15:28:46
not sure you ned this fwd declaration
Sigurður Ásgeirsson
2016/09/01 15:18:17
Done.
|
} // extern "C" |
namespace { |
@@ -39,14 +40,23 @@ void* GlibcMemalign(const AllocatorDispatch*, size_t alignment, size_t size) { |
void GlibcFree(const AllocatorDispatch*, void* address) { |
__libc_free(address); |
} |
+} |
+void GlibcFree(const AllocatorDispatch*, void* address) { |
Primiano Tucci (use gerrit)
2016/08/24 14:11:46
seems like you accidentally copy/pasted this twice
Sigurður Ásgeirsson
2016/09/01 15:18:18
Ooops, I wonder how this even compiled. Fixed :/.
|
+ __libc_free(address); |
+} |
+ |
+size_t GlibcGetSizeEstimate(const AllocatorDispatch*, void* address) { |
+ return __libc_usable_size(address); |
Primiano Tucci (use gerrit)
2016/08/24 14:11:46
I don't think you need to go down into __libc inte
Primiano Tucci (use gerrit)
2016/08/24 15:28:46
I think you mean __malloc_usable_size here.
The n
Sigurður Ásgeirsson
2016/09/01 15:18:18
Thanks, added a TODO.
Sigurður Ásgeirsson
2016/09/01 15:18:18
Done.
|
+} |
} // namespace |
const AllocatorDispatch AllocatorDispatch::default_dispatch = { |
- &GlibcMalloc, /* alloc_function */ |
- &GlibcCalloc, /* alloc_zero_initialized_function */ |
- &GlibcMemalign, /* alloc_aligned_function */ |
- &GlibcRealloc, /* realloc_function */ |
- &GlibcFree, /* free_function */ |
- nullptr, /* next */ |
+ &GlibcMalloc, /* alloc_function */ |
+ &GlibcCalloc, /* alloc_zero_initialized_function */ |
+ &GlibcMemalign, /* alloc_aligned_function */ |
+ &GlibcRealloc, /* realloc_function */ |
+ &GlibcFree, /* free_function */ |
+ &GlibcGetSizeEstimate, /* get_size_estimate_function */ |
+ nullptr, /* next */ |
}; |