OSDN Git Service

After trimming, set the footprint to the number of pages in use.
authorCarl Shapiro <cshapiro@google.com>
Wed, 29 Sep 2010 03:30:42 +0000 (20:30 -0700)
committerCarl Shapiro <cshapiro@google.com>
Wed, 29 Sep 2010 03:30:42 +0000 (20:30 -0700)
A trim can decrease the an mspace footprint but it will not decrease
its max footprint.  We need to decrease the max footprint to make any
pages recovered by a trim available to external allocations.

By setting the ideal footprint after a trim we lift any soft limit in
effect and make the mspace footprint and max footprints equal.

Change-Id: Ia6eb99634ce1d732b417a90291b110d1fc46c2e3

vm/alloc/HeapSource.c

index 25e0125..46b1c78 100644 (file)
@@ -1685,6 +1685,7 @@ static bool externalAllocPossible(const HeapSource *hs, size_t n)
      * Try trimming the mspace to reclaim unused pages.
      */
     dvmHeapSourceTrim(bytesTrimmed, NELEM(bytesTrimmed));
+    snapIdealFootprint();
     if (externalBytesAvailable(hs, n)) {
         return true;
     }