summaryrefslogtreecommitdiffstats
path: root/runtime/jni_internal.cc
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-08-25 13:08:22 -0700
committerMathieu Chartier <mathieuc@google.com>2014-08-29 16:32:03 -0700
commit5369c40f75fdcb1be7a7c06db212ce965c83a164 (patch)
tree0beace7590b66dd18470e9862602a14ef4c0f9cc /runtime/jni_internal.cc
parentf59b605f82c0e2b7bfc6019ee7bd650628f50d3a (diff)
downloadart-5369c40f75fdcb1be7a7c06db212ce965c83a164.tar.gz
art-5369c40f75fdcb1be7a7c06db212ce965c83a164.tar.bz2
art-5369c40f75fdcb1be7a7c06db212ce965c83a164.zip
Add native memory accounting through custom allocator.
Added a custom allocator that lets you pass in a special tag which specifices where the allocation came from. This is used when dumping. The performance overhead is low since each allocation only does a atomic add/sub for each allocation/free. The measurements are dumped to traces.txt during SIGQUIT. Example output: I/art (27274): AllocatorTagHeap active=120 max=120 total=168 I/art (27274): AllocatorTagMonitorList active=1572 max=6240 total=11724 I/art (27274): AllocatorTagClassTable active=185208 max=185208 total=268608 I/art (27274): AllocatorTagInternTable active=430368 max=430368 total=436080 I/art (27274): AllocatorTagMaps active=5616 max=6168 total=34392 I/art (27274): AllocatorTagLOS active=1024 max=1536 total=2044 I/art (27274): AllocatorTagSafeMap active=0 max=51936 total=533688 I/art (27274): AllocatorTagLOSMaps active=144 max=1248 total=5760 I/art (27274): AllocatorTagReferenceTable active=10944 max=11840 total=19136 I/art (27274): AllocatorTagHeapBitmap active=32 max=40 total=56 I/art (27274): AllocatorTagHeapBitmapLOS active=8 max=8 total=8 I/art (27274): AllocatorTagVerifier active=0 max=18844 total=1073156 I/art (27274): AllocatorTagModUnionCardSet active=5300 max=5920 total=56020 I/art (27274): AllocatorTagModUnionReferenceArray active=24864 max=24864 total=24864 I/art (27274): AllocatorTagJNILibrarires active=320 max=320 total=320 I/art (27274): AllocatorTagOatFile active=1400 max=1400 total=5852 Bug: 16238192 Change-Id: Ibb470ef2e9c9a24563bb46422d46a55799704d82
Diffstat (limited to 'runtime/jni_internal.cc')
-rw-r--r--runtime/jni_internal.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc
index 2156ed1912..afbd5cb7da 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -24,6 +24,7 @@
#include <vector>
#include "atomic.h"
+#include "base/allocator.h"
#include "base/logging.h"
#include "base/mutex.h"
#include "base/stl_util.h"
@@ -564,7 +565,7 @@ class Libraries {
}
private:
- SafeMap<std::string, SharedLibrary*> libraries_;
+ AllocationTrackingSafeMap<std::string, SharedLibrary*, kAllocatorTagJNILibrarires> libraries_;
};
#define CHECK_NON_NULL_ARGUMENT(value) \