From 1ae25c55391a874638f6a6366d2c8359c811b168 Mon Sep 17 00:00:00 2001 From: SangWook Han Date: Fri, 11 May 2012 20:45:33 +0900 Subject: Fix: Issue 26627: Dalvik Heap Trim timer value after GC dvmRelativeCondWait need millisecods not seconds. With this fix, trim will begins 5 seconds after concurrent GC Bug: http://code.google.com/p/android/issues/detail?id=26627 Change-Id: I3802b48e345725fb78e4ef2c999dd243ef30a138 --- vm/alloc/HeapSource.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'vm/alloc') diff --git a/vm/alloc/HeapSource.cpp b/vm/alloc/HeapSource.cpp index f61724a40..6552680d8 100644 --- a/vm/alloc/HeapSource.cpp +++ b/vm/alloc/HeapSource.cpp @@ -42,10 +42,10 @@ static void trimHeaps(); #define HEAP_IDEAL_FREE (2 * 1024 * 1024) #define HEAP_MIN_FREE (HEAP_IDEAL_FREE / 4) -/* Number of seconds to wait after a GC before performing a heap trim +/* How long to wait after a GC before performing a heap trim * operation to reclaim unused pages. */ -#define HEAP_TRIM_IDLE_TIME_SECONDS 5 +#define HEAP_TRIM_IDLE_TIME_MS (5 * 1000) /* Start a concurrent collection when free memory falls under this * many bytes. @@ -410,7 +410,7 @@ static void *gcDaemonThread(void* arg) bool trim = false; if (gHs->gcThreadTrimNeeded) { int result = dvmRelativeCondWait(&gHs->gcThreadCond, &gHs->gcThreadMutex, - HEAP_TRIM_IDLE_TIME_SECONDS, 0); + HEAP_TRIM_IDLE_TIME_MS, 0); if (result == ETIMEDOUT) { /* Timed out waiting for a GC request, schedule a heap trim. */ trim = true; -- cgit v1.2.3