[vm] Remove malloc_hooks support for jemalloc

Fuchsia is switching/has switched to scudo.

Change-Id: I0c829518652053243bf3f8db675e562ccfb448f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95663
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
This commit is contained in:
Zach Anderson 2019-03-06 19:16:27 +00:00 committed by commit-bot@chromium.org
parent 8bb8d11859
commit 825d03c585
4 changed files with 1 additions and 88 deletions

View file

@ -143,12 +143,7 @@ config("dart_config") {
}
if (is_fuchsia) {
import("//build/config/scudo/scudo.gni")
include_dirs += [ "//zircon/system/ulib/zx/include" ]
if (!use_scudo) {
defines += [ "DART_USE_JEMALLOC" ]
include_dirs += [ "//zircon/third_party/ulib/jemalloc/include" ]
}
}
if (!is_win) {

View file

@ -1,80 +0,0 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#include "platform/globals.h"
#if defined(DART_USE_JEMALLOC) && !defined(PRODUCT)
#include "vm/malloc_hooks.h"
#include <jemalloc/jemalloc.h>
#include "vm/json_stream.h"
namespace dart {
void MallocHooks::Init() {
// Do nothing.
}
void MallocHooks::Cleanup() {
// Do nothing.
}
void MallocHooks::PrintToJSONObject(JSONObject* jsobj) {
// Here, we ignore the value of FLAG_profiler_native_memory because we can
// gather this information cheaply without hooking into every call to the
// malloc library.
jsobj->AddProperty("_heapAllocatedMemoryUsage",
heap_allocated_memory_in_bytes());
jsobj->AddProperty("_heapAllocationCount", allocation_count());
}
intptr_t MallocHooks::heap_allocated_memory_in_bytes() {
uint64_t epoch = 1;
size_t epoch_sz = sizeof(epoch);
int result = mallctl("epoch", &epoch, &epoch_sz, &epoch, epoch_sz);
if (result != 0) {
return 0;
}
intptr_t allocated;
size_t allocated_sz = sizeof(allocated);
result = mallctl("stats.allocated", &allocated, &allocated_sz, NULL, 0);
if (result != 0) {
return 0;
}
return allocated;
}
intptr_t MallocHooks::allocation_count() {
return 0;
}
bool MallocHooks::ProfilingEnabled() {
return false;
}
bool MallocHooks::stack_trace_collection_enabled() {
return false;
}
void MallocHooks::set_stack_trace_collection_enabled(bool enabled) {
// Do nothing.
}
void MallocHooks::ResetStats() {
// Do nothing.
}
bool MallocHooks::Active() {
return false;
}
Sample* MallocHooks::GetSample(const void* ptr) {
return NULL;
}
} // namespace dart
#endif // defined(DART_USE_JEMALLOC) && ...

View file

@ -4,8 +4,7 @@
#include "platform/globals.h"
#if (!defined(DART_USE_TCMALLOC) && !defined(DART_USE_JEMALLOC)) || \
defined(PRODUCT)
#if defined(PRODUCT) || !defined(DART_USE_TCMALLOC)
#include "vm/malloc_hooks.h"

View file

@ -152,7 +152,6 @@ vm_sources = [
"malloc_hooks_arm.cc",
"malloc_hooks_arm64.cc",
"malloc_hooks_ia32.cc",
"malloc_hooks_jemalloc.cc",
"malloc_hooks_tcmalloc.cc",
"malloc_hooks_unsupported.cc",
"malloc_hooks_x64.cc",