GC_CONCURRENT
is invoked in gcDaemonThread()
.
Where and When GC_CONCURRENT invoke?
-
27-09-2022 - |
Question
I found the source code of dalvikvm, but could not find where the concurrent GC invoke.
The malloc code I got from the android git repository
static void gcForMalloc(bool clearSoftReferences)
{
if (gDvm.allocProf.enabled) {
Thread* self = dvmThreadSelf();
gDvm.allocProf.gcCount++;
if (self != NULL) {
self->allocProf.gcCount++;
}
}
/* This may adjust the soft limit as a side-effect.
*/
const GcSpec *spec = clearSoftReferences ? GC_BEFORE_OOM : GC_FOR_MALLOC;
dvmCollectGarbageInternal(spec);
}
I think the dvmCollectGarbageInternal function prinft the GC LOG, but there is nothing about the GC_CONCURRENT.
The dvmCollectGarbageInternal function's log code
if (!spec->isConcurrent) {
u4 markSweepTime = dirtyEnd - rootStart;
u4 gcTime = gcEnd - rootStart;
bool isSmall = numBytesFreed > 0 && numBytesFreed < 1024;
ALOGD("%s freed %s%zdK, %d%% free %zdK/%zdK, paused %ums, total %ums",
spec->reason,
isSmall ? "<" : "",
numBytesFreed ? MAX(numBytesFreed / 1024, 1) : 0,
percentFree,
currAllocated / 1024, currFootprint / 1024,
markSweepTime, gcTime);
} else {
u4 rootTime = rootEnd - rootStart;
u4 dirtyTime = dirtyEnd - dirtyStart;
u4 gcTime = gcEnd - rootStart;
bool isSmall = numBytesFreed > 0 && numBytesFreed < 1024;
ALOGD("%s freed %s%zdK, %d%% free %zdK/%zdK, paused %ums+%ums, total %ums",
spec->reason,
isSmall ? "<" : "",
numBytesFreed ? MAX(numBytesFreed / 1024, 1) : 0,
percentFree,
currAllocated / 1024, currFootprint / 1024,
rootTime, dirtyTime, gcTime);
}
The above code is from master branch of Android, and my nexus phone's Android version is 4.4.2.
Do I miss something?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow