Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(382)

Unified Diff: base/allocator/allocator_shim.cc

Issue 55333002: Make possible to check memory allocations inside chromium (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/process/memory.h » ('j') | base/process/memory.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/allocator/allocator_shim.cc
diff --git a/base/allocator/allocator_shim.cc b/base/allocator/allocator_shim.cc
index 1d8229117d77a27035c84a33523b230eea7a3351..239b378216924a6ca5d46d325c1022457b80bef2 100644
--- a/base/allocator/allocator_shim.cc
+++ b/base/allocator/allocator_shim.cc
@@ -201,6 +201,20 @@ void* realloc(void* ptr, size_t size) __THROW {
return new_ptr;
}
+// This does not call the new handler but let the caller
+// check whether the allocation succeed.
+void* allocator_shim_try_malloc(size_t size) __THROW {
+ switch (allocator) {
+ case JEMALLOC:
+ return je_malloc(size);
+ case WINHEAP:
+ case WINLFH:
+ return win_heap_malloc(size);
+ case TCMALLOC:
+ return do_malloc(size);
+ }
+}
+
// TODO(mbelshe): Implement this for other allocators.
void malloc_stats(void) __THROW {
#ifdef ENABLE_DYNAMIC_ALLOCATOR_SWITCHING
« no previous file with comments | « no previous file | base/process/memory.h » ('j') | base/process/memory.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698