Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit ffec622c authored by Balamurugan Thanikachalam's avatar Balamurugan Thanikachalam Committed by Arne Coucheron
Browse files

frameworks/base: Increased Zygote preload GC threshold to half the heap size

Zygote process preloads classes and resources while preparing the heap for
all the processes. Garbage Collection is done in this preload loop to make
the heap copy good before the heap is copied to the other processes.
This Garbage Collection is done inside the preload loops  once a threshold
(PRELOAD_GC_THRESHOLD) is reached. This threshold is hardcoded to be 50000
bytes - a very low value, resulting in Garbage being unnecessarily collected
repeatedly while preloading classes and resources, contributing to boot time.
Garbage is also collected after the preloading stage is completed, which
makes the GC done inside preload loop redundant.

This change increases the threshold to be dynamically set to half the heap
size specified in the dalvik vm. This ensures the GC is normally skipped
inside the preload loop while still invoking GC in corner cases where the
heap usage might cross 50% in the preload stage.

Change-Id: I3e9841c04c04cf06a3f1eaa1bed66fa83209c0cb
parent c23a086f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment