paul-bjorkstrand opened a new pull request #9: Fix SLING-7586 using 
SoftReferences and WeakHashMap
URL: https://github.com/apache/sling-org-apache-sling-models-impl/pull/9
 
 
   Allows the GC to collect cached model instances, even when self-referenced 
to the original adaptable (e.g. via @Self)
   
   This is slightly different than #6, as it allows the models to be cached, 
and not collected until the GC needs memory. The original fix in #6 would allow 
the GC to indiscriminately remove cached models, as soon as they were no longer 
strongly referenced, which can have a negative performance impact. Using 
SoftReference instead of WeakReference mitigates this impact, to some degree. 
There is still a risk of a model being created then suddenly garbage collected 
when no longer strongly referenced, but this implementation allows the model to 
live for as long as it can.
   
   A test has been included that fails before this patch (with a JVM killing 
OOM), but passes after.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to