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

Unified Diff: runtime/vm/malloc_hooks.cc

Issue 2700033003: Disabled MallocHooks code in Release due to performance concerns. Added enable_malloc_hooks flag to… (Closed)
Patch Set: Disabled MallocHooks code in Release due to performance concerns. Added enable_malloc_hooks flag to… Created 3 years, 10 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 | « runtime/vm/flag_list.h ('k') | runtime/vm/malloc_hooks_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/malloc_hooks.cc
diff --git a/runtime/vm/malloc_hooks.cc b/runtime/vm/malloc_hooks.cc
index 08a053a81d19b0b32f277a71a89a9095e50dce7d..4f7de9e20d70b8b4c0326e5d47d996f0496ea5dc 100644
--- a/runtime/vm/malloc_hooks.cc
+++ b/runtime/vm/malloc_hooks.cc
@@ -203,6 +203,9 @@ AddressMap* MallocHooksState::address_map_ = NULL;
void MallocHooks::InitOnce() {
+ if (!FLAG_enable_malloc_hooks) {
+ return;
+ }
MutexLocker ml(MallocHooksState::malloc_hook_mutex());
ASSERT(!MallocHooksState::Active());
@@ -219,6 +222,9 @@ void MallocHooks::InitOnce() {
void MallocHooks::TearDown() {
+ if (!FLAG_enable_malloc_hooks) {
+ return;
+ }
MutexLocker ml(MallocHooksState::malloc_hook_mutex());
ASSERT(MallocHooksState::Active());
@@ -235,6 +241,9 @@ void MallocHooks::TearDown() {
void MallocHooks::ResetStats() {
+ if (!FLAG_enable_malloc_hooks) {
+ return;
+ }
MutexLocker ml(MallocHooksState::malloc_hook_mutex());
if (MallocHooksState::Active()) {
MallocHooksState::ResetStats();
@@ -243,12 +252,18 @@ void MallocHooks::ResetStats() {
bool MallocHooks::Active() {
+ if (!FLAG_enable_malloc_hooks) {
+ return false;
+ }
ASSERT(MallocHooksState::malloc_hook_mutex()->IsOwnedByCurrentThread());
return MallocHooksState::Active();
}
void MallocHooks::PrintToJSONObject(JSONObject* jsobj) {
+ if (!FLAG_enable_malloc_hooks) {
+ return;
+ }
intptr_t allocated_memory = 0;
intptr_t allocation_count = 0;
bool add_usage = false;
@@ -271,12 +286,18 @@ void MallocHooks::PrintToJSONObject(JSONObject* jsobj) {
intptr_t MallocHooks::allocation_count() {
+ if (!FLAG_enable_malloc_hooks) {
+ return 0;
+ }
MutexLocker ml(MallocHooksState::malloc_hook_mutex());
return MallocHooksState::allocation_count();
}
intptr_t MallocHooks::heap_allocated_memory_in_bytes() {
+ if (!FLAG_enable_malloc_hooks) {
+ return 0;
+ }
MutexLocker ml(MallocHooksState::malloc_hook_mutex());
return MallocHooksState::heap_allocated_memory_in_bytes();
}
« no previous file with comments | « runtime/vm/flag_list.h ('k') | runtime/vm/malloc_hooks_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698