Introduce JniStringCache to cache jstring instances.
This change adds a native cache of jstrings created from native strings. The goal is to reduce duplicate java.lang.String instances. Demonstrate usage, and test correctness, by integrating with Parcel. On background trim (sent just before transition GC prior to freeze), clear the cache to maximize potential GC returns. Running this on my local device, producing stats from dumpsys meminfo, and processing them, I get: https://docs.google.com/spreadsheets/d/1tVvMROAOhgphJNuFZoavNh7jG0iTErUHYP2DnQnascE/edit?usp=sharing Most processes have a >80% hit rate. Flag: android.os.parcel_string_cache_enabled Bug: 442140362 Change-Id: I818ad94dd90d58576f5f86bc8a5c6d67dd5ec61a
Loading
Please register or sign in to comment