History log of /dalvik/vm/alloc/HeapInternal.h
Revision Date Author Comments
af6cf54652d1b27885b99e216bee29b955052630 04-Nov-2011 Andy McFadden <fadden@android.com> Reduce Dalvik card table overhead

The VM has a "growth limit" (e.g. 48MB) that is used to cap normal
apps, and a "max heap" (e.g. 128MB) that is used for apps with unusual
high-memory requirements. The Dalvik GC uses a 128:1 "card table"
that spans the entire managed heap, out to the "max heap" limit.

The table is erased during every concurrent GC. The first time
we do that post-zygote, the copy-on-write behavior causes physical
pages to be allocated. We're currently clearing out to the heap max,
not the growth limit, which means we have a bunch of physical memory
allocated for pages that will never be used.

This changes it so we only clear out to the growth limit. If the
growth limit is removed by the app, we clear out to the heap max.
On devices with a 128MB max heap, this reduces the private/dirty
usage for most apps by 640KB.

Bug 5567332

Change-Id: Iac633017c128d63b284d48016e47d40cc46df1de
1663a6c12fdf4732d7ea0a0406af6085b3c408e4 12-Oct-2011 Steve Block <steveblock@google.com> Rename (IF_)LOG() to (IF_)ALOG() DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/141576

Bug: 5449033
Change-Id: Ie3bc0d5436218ea05f98cb0373ecf5924f78db05
b2714082bad44fde247920b9280c1b40c4979c3a 10-Oct-2011 Ben Cheng <bccheng@android.com> Revert "Use the card table to scan the immune region of the heap."

This reverts commit 6c355e53332502314c3d82a7afcf898d66118f27.

Conflicts are resolved in:

vm/alloc/CardTable.cpp
vm/alloc/HeapBitmap.cpp
vm/alloc/HeapInternal.h
vm/alloc/HeapSource.cpp
vm/alloc/MarkSweep.cpp

Tested with overnight monkey runs + Delaunay.

Bug: 5037417
Change-Id: I400eff8542d0bddd865ce570a479f7750c1ba484
375fb116bcb817b37509ab579dbd55cdbb765cbf 15-Jun-2011 Carl Shapiro <cshapiro@google.com> Normalize the include guard style.

An leading underscore followed by a capital letter is a reserved
name space in C and C++.

This change also moves any #include directives within the include
guard in some of the compiler/codegen/arm header files.

Change-Id: I9715e2c5301699d31886e61d0fe6e29483555a2a
eebf7c690a6aabd50d70779d72685090a1eb84ff 08-Jun-2011 Carl Shapiro <cshapiro@google.com> Fix two issues with the card table.

Several tricks are used to adjust the base of the card table to save
instructions in the write barrier. This change corrects two
situtations where the card table did not properly account for the
effects of these tricks.

First, the card table is over allocated to ensure that the start
address can be magically aligned. When releasing the allocation these
additional bytes were not supplied to munmap creating a potential
leak.

Second, the valid card check did not use the right base address for a
containment check. The check used the allocation base which is may be
lower than the actual starting address. This would cause valid cards
at the high end of the heap to be considered invalid and invalid cards
at the low end of the heap to be considered valid.

Change-Id: I83bf4167b7c081c8626b6ff504342f42d0e776a2
a97851ecdf95dd1a401ddb7469ec78666d2d28f0 12-May-2011 Carl Shapiro <cshapiro@google.com> Fix a comment and remove some horizontal white space.

Change-Id: Id0a9c4f8ee073e8260571a0f48605ae1f9b04219
50e5fd5984c9b0a6f0927ed5ddf13bde40e338c7 27-Apr-2011 Carl Shapiro <cshapiro@google.com> Use C++ linkage in GC headers and remove unneeded typedefs.

Some interfaces in Alloc.h had to be left with C linkage as they are
referenced by the interpreter assembler code. That dependency will be
addressed in a future commit.

Change-Id: I6b2097a2139ddf6b4b13e592710e241442e08488
ae188c676c681e47a93ade7fdf0144099b470e03 08-Apr-2011 Carl Shapiro <cshapiro@google.com> Compile the garbage collector and heap profiler as C++.

Change-Id: I25d8fa821987a3dd6d7109d07fd42dbf2fe0e589
ce87bfed41bbe4248b2770fb1a90f34b2518f6fa 31-Mar-2011 Carl Shapiro <cshapiro@google.com> Delegate the queuing of cleared references to managed code.

Previously, the garbage collector would pass each cleared reference to
the heap worker thread for queuing. The heap worker thread would then
perform a callback into managed code for each cleared reference which
assigned the reference to its reference queue.

With this change, the garbage collector instead links together all of
the cleared references and calls back into managed code exactly once
to hand off the references for processing. This change makes the heap
worker thread and its data structures obsolete.

Change-Id: I28e02638f0877a7fd2ac96b9c3f5597a38541ebb
3475f9cdb47a6d6f8ad2ce49bbc3af46bca92f09 21-Mar-2011 Carl Shapiro <cshapiro@google.com> Move finalization out of the VM.

This change introduces a new reference class whose referent
points to instances requiring finalization. This makes the
finalization of objects possible using a reference queue and
a dedicated thread which removes objects from the queue.

Change-Id: I0ff6dd272f00ca08c6ed3aa667bf766a039a944e
6c355e53332502314c3d82a7afcf898d66118f27 03-Mar-2011 Carl Shapiro <cshapiro@google.com> Use the card table to scan the immune region of the heap.

Using the card table results in a dramatic cost reduction in scanning
time. During a reboot, scanning each object in the zygote for
pointers to the application heap costs an average of 20ms of thread
time on a stingray with 8 megabyte zygote. In comparison, scanning
dirty cards in the zygote costs 300us on average.

Change-Id: I1dba35646d509e6b1b4535e291a1eb6f66d7b218
6c60c48f2af559aa196b74026a86aca2b9921cca 20-Jan-2011 Carl Shapiro <cshapiro@google.com> Remove logging of memory management statistics to the event log.

While the event log used to report better information than the logcat
log messages, this is no longer the case.

Change-Id: Iaf7bef5252c284c1a159bc8c0447247c5b5f47e4
a5e14d6a98c48d8eeb24f4977ff33d831e37b2d3 02-Dec-2010 Carl Shapiro <cshapiro@google.com> Get rid of QUIET_ZYGOTE_GC and make it the default.

Change-Id: Ib9af028cfa46ca6041d716085ed3a78ef591bbc8
18555fcb8927533485eb9ee739230839ac038b20 02-Dec-2010 Carl Shapiro <cshapiro@google.com> Move a stray forward declaration of HeapSource to where it's needed.

Change-Id: I10dcc065c90ce40685b20a362470a32e213bf28f
07018e2d14b012ae433a0d82025a885ed8debc3b 27-Oct-2010 Carl Shapiro <cshapiro@google.com> Separate HPROF from the GC.

In the beginning, the only way to traverse the roots and heap was to
piggyback off the garbage collector. As such, HPROF was implemented
by instrumenting the root- and object traversal routines to check a
mode flag and call into HPROF during a GC when the flag was set.

This change moves the HPROF calls out of the GC and into callbacks
invoked through the visitor. Notably, it allows HPROF dumps to be
computed at any point in time without invoking a GC and potentially
destroying evidence relating to the cause of an OOM.

Change-Id: I2b74c4f10f35af3ca33b7c0bbfe470a8b586ff66
4dc622c5b4ce48b5f2f0a0f92f316dd557fc950f 31-Jul-2010 Carl Shapiro <cshapiro@google.com> Remove the dvmHeapSizeChanged no-op routine.

Change-Id: I6deb4ea858610edee6e7aa44d49d91cae5a25404
03f3b1394cc8421d125fd00455858944f0e9808d 28-Jul-2010 Carl Shapiro <cshapiro@google.com> Separately report thread suspension and garbage collection times.

The GC elapsed time written to the log used to be the sum of the time
spent suspending threads and the time spent executing the rest of the
garbage collector code. With this change we account for each of these
phases separately. With the concurrent GC, thread suspension can
dominate the GC pause times so breaking this number out gives a clear
picture of the efficiency of the underlying GC algorithm.

Also, accounting for the concurrent garbage collector is more
accurate. The start and end times did not subtract the amount of time
spent during the concurrent mark. The clock is now stopped and
restarted during the concurrent phase of the collector.

Change-Id: Icf3f8c0e183166a62ca1bf32fc77f17e3b5aa963
4b851a75f7712086a9fc4427f68c99b83725f37d 10-Jul-2010 Andy McFadden <fadden@android.com> Allow heap dump requests with a FileDescriptor arg.

Part of a larger change to allow "am" to initiate hprof heap dumps.

The original implementation wrote data to a temp file, because we
compute the second part first while doing GC work. Now all paths
work like DDMS, writing all data to a memstream and then copying it
out to a file at the very end.

Also, fix a potential fd leak on failure in the profiling code.

Bug 2759474.

Change-Id: I0f838cbd9948a23088f08463c3008be7198d76e7
4496ed9ef85e19447e697481d16842f47d265756 12-Jul-2010 Barry Hayes <bhayes@google.com> Move the biasedCardTableBase out of the non-public GcHeap structure,
and back to DvmGlobals where it can be found. Create dvmIsValidCard to
access the values hidden in the GcHeap.

This is a half-step to inlining dvmMarkCard and dvmCardFromAddr.

Change-Id: I50158915802d7f08ddadb60ca6907afd279df2a8
6e5cf6021b2f3e00e18ab402f23ab93b27c6061b 22-Jun-2010 Barry Hayes <bhayes@google.com> Quicker partial collection by using card marking.

Add calls to the card marking from the write barrier routines, so that
a write to an Object marks the appropriate card. Add code in the GC to
use and rebuild the cards at a partial GC, clearing cards in the
Zygote heap which do not in fact contain references to the application
heap.

Change-Id: Ie6f29fd096e029f48085715b282b6db8a7122555
d4f78d3a764e6aa8f7174c78f537c016dac7f7ec 08-Jun-2010 Barry Hayes <bhayes@google.com> ALLOC_NO_GC is no longer used; remove it, and the nonCollectableRefs table.
Clean up dvmHeapInitHeapRefTable's interface to know the default size.

Change-Id: I535fdfe39924f6f65f286e2809002c2a0e6411b6
fbdcfb9ea9e2a78f295834424c3f24986ea45dac 29-May-2010 Brian Carlstrom <bdc@google.com> Merge remote branch 'goog/dalvik-dev' into dalvik-dev-to-master

Change-Id: I0c0edb3ebf0d5e040d6bbbf60269fab0deb70ef9
2f4e2889a31da3eb6d825695a21f36629a3a7e51 27-May-2010 Carl Shapiro <cshapiro@google.com> Remove unused mark tracking code.

Change-Id: I5164f0a357b3823db8fb3ee33da953c1bf293674
2954074adc6a9793f38c0c58d03ec1dc057406eb 26-Mar-2010 Carl Shapiro <cshapiro@google.com> Reference class handling overhaul.

* Do not mark through soft-reachable referents when scanning f-
reachable objects.

* Make the SoftReference clearing policy local to better conform to
developer expecataions.

* Eliminate SCHEDULED_REFERENCE_MAGIC, a hold-over from a previous
reference management algorithm.

* Move soft, weak and phantom reference processing into their own
subroutines.

Change-Id: I992788d58f10fa08336e6ac3f0a4dbfa3fc2086f
6343bd071555458d0cb071f2eaf15b59b36771bf 17-Feb-2010 Carl Shapiro <cshapiro@google.com> Eliminate the heap chunk abstraction. This temporarily breaks the
hprof feature that allows stack traces to be associated with objects.
6bf992c9d51f1e12aa37fe4c791c156402a9b79b 29-Jan-2010 Andy McFadden <fadden@android.com> Add support for streaming hprof dumps.

This adds the dumpHprofDataDdms method, which generates the hprof dump
in RAM and then spits the whole thing at DDMS. The idea is to avoid
touching /sdcard, since not all apps have permission to do that.

This rearranges hprofShutdown() a fair bit. It used to re-use a context
struct, saving interesting bits to local variables before zapping it;
now we just create a second context struct and free both at the end.

For bug 2092855.
6d4ff75a473a9253dc274959d600a90c4da81a32 12-Sep-2009 Carl Shapiro <cshapiro@google.com> Remove unused WITH_OBJECT_HEADERS code.
8c880b9e903504fa9c61d9964ba2379f0e060af5 25-Mar-2009 Andy McFadden <> Automated import from //branches/donutburger/...@140700,140700
99409883d9c4c0ffb49b070ce307bb33a9dfe9f1 19-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import //branches/master/...@140412
f6c387128427e121477c1b32ad35cdcaa5101ba3 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
f72d5de56a522ac3be03873bdde26f23a5eeeb3c 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
5d709784bbf5001012d7f25172927d46f6c1abe1 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
2ad60cfc28e14ee8f0bb038720836a4696c478ad 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution