History log of /dalvik/vm/alloc/CardTable.cpp
Revision Date Author Comments
38c8baa0ece45abc2a2a53fe3d53dda84d28dd4c 08-Aug-2013 Mathieu Chartier <mathieuc@google.com> Fix broken card table asserts.

We had an off by one error due to getting the card for the heap
source limit. This is not a valid card when the heap is at
maximum size, but doesn't need to be since we do less than
comparison on it. Fixed another error where we didn't take into
account the biased begin in an assert.

Did a bit of refactoring by removing useless if statement.

Fixes 061-out-of-memory, 080-oom-throw.

Bug: https://code.google.com/p/android/issues/detail?id=42868

(cherry picked from commit ee903e174872edd0ecc6f1940c7412892cd49123)

Change-Id: If677c93e46fe1ee5729eec1820b1bd9682b4f924
a86e99bacbe72f2a8914c4339646a6aba488afcd 08-Aug-2013 Mathieu Chartier <mathieuc@google.com> Fix broken card table asserts.

We had an off by one error due to getting the card for the heap
source limit. This is not a valid card when the heap is at
maximum size, but doesn't need to be since we do less than
comparison on it. Fixed another error where we didn't take into
account the biased begin in an assert.

Did a bit of refactoring by removing useless if statement.

Fixes 061-out-of-memory.

Bug: 8282011
Change-Id: I66e3026e7b98b738ecfbced101846ec9f184ab70
(cherry picked from commit ee903e174872edd0ecc6f1940c7412892cd49123)
ebaf918e1bacff53c3dc3f0861c5cee851db23e5 10-Jul-2013 Mathieu Chartier <mathieuc@google.com> Add low memory mode option.

Added a low memory mode option which can be enabled by passing the
flag "-XX:LowMemoryMode" to the VM.

Changed dvmHeapSourceAlloc to use mspace_malloc and madvise page
aligned regions of allocations back to the kernel if low
memory mode is enabled. No measurable performance penalty on a
benchmark which does 4 million object allocations. This seems to
reduce the Dalvik total PSS by 10 - 15% on devices with
large bitmaps (such as manta or flo).

Another change is that cards are madvised instead of memset when
cleared if low memory mode is enabled. This saves a minor amount
of memory at the cost of having slightly more page faults.

Change-Id: I0c850bc370ebabf4393bff1c47d3257b2f1518d2
c1a4ab9c313d8a3d12007f2dbef7b5a6fa4ac2ef 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE

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

Also fix an occurrence of LOGW missed in an earlier change.

Bug: 5449033
Change-Id: I2e3b23839e6dcd09015d6402280e9300c75e3406
062bf509a77fce9dfcb7e7b2e401cf2a124d83d5 20-Dec-2011 Steve Block <steveblock@google.com> Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/156016

Bug: 5449033
Change-Id: Ic663376d1ad6a6cb14bf81405ad9afd247cf2f60
cab0fdf82a668e2a1a054cd6506835046218e419 08-Nov-2011 Andy McFadden <fadden@android.com> DO NOT MERGE Further refinement of card table clear

We're currently using memset() to clear cards out to the growth
limit, which on a device configured for 48MB/128MB process caps
means we're sitting on 384KB or 1MB of pages. We can reduce that
substantially.

This change attempts to reduce the memset() length to the currently
active portion of the card table, based on the placement of objects
in the "live objects" bitmap. This should avoid faulting in card
pages that we don't actually need.

This is suboptimal when parts of the card table are used briefly
and then ignored for a while. An alternative implementation, which
uses madvise(DONTNEED) aggressively, is also included (#ifdefed out).

Bug 5567332

(cherry-pick from master)

Change-Id: I6b181de20a0c8b6307acaebbc5d6dac20422f25d
c0a18856ed67b0e77a8202028f27948e1387243d 08-Nov-2011 Andy McFadden <fadden@android.com> Further refinement of card table clear

We're currently using memset() to clear cards out to the growth
limit, which on a device configured for 48MB/128MB process caps
means we're sitting on 384KB or 1MB of pages. We can reduce that
substantially.

This change attempts to reduce the memset() length to the currently
active portion of the card table, based on the placement of objects
in the "live objects" bitmap. This should avoid faulting in card
pages that we don't actually need.

This is suboptimal when parts of the card table are used briefly
and then ignored for a while. An alternative implementation, which
uses madvise(DONTNEED) aggressively, is also included (#ifdefed out).

Bug 5567332

Change-Id: I7663ae7d15d0aaa8158deed5e331bf05333da6bb
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
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
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
0d92a4072c00434e95a03642a4944acf81a81cc3 08-Jun-2011 Carl Shapiro <cshapiro@google.com> Favor Object* over void* for the heap bitmap interfaces.

Change-Id: I615dbff3e81a1128dc3ba43d6d426c370ae3abcf
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
1e1433e78f560a01744e870c19c162ab88df9dc1 21-Apr-2011 Carl Shapiro <cshapiro@google.com> Remove unneeded void argument list declarations.

Change-Id: Ica749f6defa890363ec531b29e25bc415dc2cbb9
f9fa8c14c7ef87b4318d606bfc5132df7b77b17c 09-Apr-2011 Carl Shapiro <cshapiro@google.com> Fix for loops and eliminate some other undesirable idioms.

Previously, we were using a non-standard C dialect which did not permit
the nicer variable scoping in loops. Now that we are using C++ in the
collector we can guarantee that feature is available. This change also
rearranges some of the surrounding code to take advantage of the more
flexible scoping rules.

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

Change-Id: I25d8fa821987a3dd6d7109d07fd42dbf2fe0e589