2022-03-28 19:11:22 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2020-04-14 20:15:33 +00:00
|
|
|
From: Daniel Micay <danielmicay@gmail.com>
|
|
|
|
Date: Wed, 11 Sep 2019 06:47:11 -0400
|
|
|
|
Subject: [PATCH] disable ICU cache pinning for exec spawning
|
|
|
|
|
|
|
|
---
|
|
|
|
.../main/java/dalvik/system/ZygoteHooks.java | 26 +++++++++++--------
|
|
|
|
1 file changed, 15 insertions(+), 11 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/dalvik/src/main/java/dalvik/system/ZygoteHooks.java b/dalvik/src/main/java/dalvik/system/ZygoteHooks.java
|
2022-03-15 19:41:05 +00:00
|
|
|
index de5a056143..e77cec2517 100644
|
2020-04-14 20:15:33 +00:00
|
|
|
--- a/dalvik/src/main/java/dalvik/system/ZygoteHooks.java
|
|
|
|
+++ b/dalvik/src/main/java/dalvik/system/ZygoteHooks.java
|
2022-03-28 19:11:22 +00:00
|
|
|
@@ -49,15 +49,17 @@ public final class ZygoteHooks {
|
2020-04-14 20:15:33 +00:00
|
|
|
*/
|
|
|
|
@libcore.api.CorePlatformApi
|
|
|
|
public static void onBeginPreload(boolean fullPreload) {
|
|
|
|
- // Pin ICU data in memory from this point that would normally be held by soft references.
|
|
|
|
- // Without this, any references created immediately below or during class preloading
|
|
|
|
- // would be collected when the Zygote GC runs in gcAndFinalize().
|
|
|
|
- CacheValue.setStrength(CacheValue.Strength.STRONG);
|
|
|
|
-
|
|
|
|
- // Explicitly exercise code to cache data apps are likely to need.
|
|
|
|
- ULocale[] localesToPin = { ULocale.ROOT, ULocale.US, ULocale.getDefault() };
|
|
|
|
- for (ULocale uLocale : localesToPin) {
|
|
|
|
- new DecimalFormatSymbols(uLocale);
|
|
|
|
+ if (fullPreload) {
|
|
|
|
+ // Pin ICU data in memory from this point that would normally be held by soft references.
|
|
|
|
+ // Without this, any references created immediately below or during class preloading
|
|
|
|
+ // would be collected when the Zygote GC runs in gcAndFinalize().
|
|
|
|
+ CacheValue.setStrength(CacheValue.Strength.STRONG);
|
|
|
|
+
|
|
|
|
+ // Explicitly exercise code to cache data apps are likely to need.
|
|
|
|
+ ULocale[] localesToPin = { ULocale.ROOT, ULocale.US, ULocale.getDefault() };
|
|
|
|
+ for (ULocale uLocale : localesToPin) {
|
|
|
|
+ new DecimalFormatSymbols(uLocale);
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
2022-03-15 19:41:05 +00:00
|
|
|
// Framework's LocalLog is used during app start-up. It indirectly uses the current ICU time
|
2022-03-28 19:11:22 +00:00
|
|
|
@@ -72,8 +74,10 @@ public final class ZygoteHooks {
|
2020-04-14 20:15:33 +00:00
|
|
|
*/
|
|
|
|
@libcore.api.CorePlatformApi
|
|
|
|
public static void onEndPreload(boolean fullPreload) {
|
|
|
|
- // All cache references created by ICU from this point will be soft.
|
|
|
|
- CacheValue.setStrength(CacheValue.Strength.SOFT);
|
|
|
|
+ if (fullPreload) {
|
|
|
|
+ // All cache references created by ICU from this point will be soft.
|
|
|
|
+ CacheValue.setStrength(CacheValue.Strength.SOFT);
|
|
|
|
+ }
|
|
|
|
|
2022-03-15 19:41:05 +00:00
|
|
|
// Clone standard descriptors as originals closed / rebound during zygote post fork.
|
|
|
|
FileDescriptor.in.cloneForFork();
|