-
-
Notifications
You must be signed in to change notification settings - Fork 795
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
Improve buffer recycling for platforms that have broken SoftReference (Android) #67
Comments
Ok, one complication: the way |
Quick note: Jackson 2.6 adds |
We see a class loader memory leak by using jackson: on redeployment of our application in WebSphere we see an increase of heap usage of a couple of hundred MB's en after several redeployments heap usage becomes close to the heap size and garbage collection takes a lot of CPU. SoftReferences may help to prevent out of memory errors, it doesn't help for gc overhead (including long compaction pauses.) We would like Jackson to release/remove the BufferRecyclers from the ThreadLocals on shutdown, by calling a shutdown method on e.g. JsonFactory. |
@jborgers Could you file a separate issue, since although it is sort of related, it sounds like separate issue? Thank you for the links that might be helpful here. |
One thought on |
Solved by #1089 for Jackson 2.16 and later: pluggable buffer recyclers including multipl non-SoftReference based alternatives. |
Since Google seems unable to provide sane handling for SoftReferences, perhaps we can work-around this issue to some degree, at least for a relatively common case of single-threaded reuse.
The basic idea would be that before checking for combination of
ThreadLocal
andSoftReference
, it'd be possible to use a shareAtomicReference
for a single buffer. If an instance is found this way, it could avoid use of SoftReference-based alternative; if not, it could use current handling.This should not add significant overhead over current approach (it might even improve it slightly), but should work better on Android.
The text was updated successfully, but these errors were encountered: