Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICU-22761 Optimize get value of LocaleObjectCache #2984

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

imurluck
Copy link

@imurluck imurluck commented Apr 29, 2024

When invoking get(K key) method of LocaleObjectCache, it may be blocked for a long time, looping in lines 45 and 53, because after the referent of SoftReference is set to NULL, it may take a long time to add SoftReference to its ReferenceQueue if GC is slowly.

For example, in the Concurrent Copying GC in Android Art virtual machine, the referent in SoftReference is set to null during the copying phase, while the SoftReference is added to its ReferenceQueue in the ReferenceQueueDaemon thread after GC, which experiences a long time in between

In fact, we have found many examples of blocking for more than 10s on some Android devices

Checklist
  • Required: Issue filed: https://unicode-org.atlassian.net/browse/ICU-22761
  • Required: The PR title must be prefixed with a JIRA Issue number.
  • Required: The PR description must include the link to the Jira Issue, for example by completing the URL in the first checklist item
  • Required: Each commit message must be prefixed with a JIRA Issue number.
  • Issue accepted (done by Technical Committee after discussion)
  • Tests included, if applicable
  • API docs and/or User Guide docs changed or added, if applicable

@imurluck imurluck force-pushed the ICU-22761-locale-object-cache-blocked branch from 9131585 to b053f66 Compare April 29, 2024 13:14
@jira-pull-request-webhook
Copy link

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@imurluck
Copy link
Author

imurluck commented May 6, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants