OSDN Git Service

Restore DDMS recent allocation tracking's behavior
authorMan Cao <manc@google.com>
Fri, 12 Jun 2015 05:47:35 +0000 (22:47 -0700)
committerMan Cao <manc@google.com>
Mon, 22 Jun 2015 23:52:08 +0000 (16:52 -0700)
commit1ed11b9ad5512cf464cb1686640df53201fa5297
tree7466c110f74fb736a8f00e60a24ac841d1c0213a
parent5aa39bb7f93cf2e8f73d06980b588519825c0ebe
Restore DDMS recent allocation tracking's behavior

Make the allocation tracker mark recently allocated objects as roots,
so the allocation records are not swept. Because DDMS needs recent
allocation tracking records even for dead objects. This should fix
the flaky failures for 098-ddmc test, but it cannot pass GC stress
test (OOM). Re-enabled 098-ddmc for other tests.

There should be an option to not mark them as roots, when user only
needs HPROF dump with traces but not DDMS's recent allocation tracking.
Probably need to add a new JNI API function for this option.

There could be another way to keep a second list of recent allocation
records and maintain a type cache for them, so not to make the objects
roots. But it's more complex, and not sure which is better.

Also reduce memory usage for AllocRecordStackTrace objects, and change
default stack depth to 16. Rename the property that controls the stack
depth to "debug.allocTracker.maxStackDepth" so developer can change it.

Bug:20037135
Change-Id: Ic6b9ae87bdcda558be6f14ded8057e763439881c
runtime/debugger.cc
runtime/gc/allocation_record.cc
runtime/gc/allocation_record.h
runtime/gc/heap.cc
runtime/gc/heap.h
runtime/gc_root.h
runtime/runtime.cc
test/098-ddmc/src/Main.java
test/Android.run-test.mk