mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
[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:
parent
8bb8d11859
commit
825d03c585
|
@ -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) {
|
||||
|
|
|
@ -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) && ...
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue