css4j / echosvg

SVG implementation in the Java™ Language, fork of Apache Batik, supporting level 4 selectors and colors.
Apache License 2.0
39 stars 2 forks source link

bridge: replace the `WeakReference` in `SVGAnimationEngine` with a `SoftReference` #104

Closed carlosame closed 2 months ago

carlosame commented 2 months ago

In SVGAnimationEngine the animation engine is kept as a WeakReference, but with the current JVMs those references do not last very long. This may cause some animations to not happen.

Also due to that, the SwingMemoryLeakTest requires at least 4GB of heap space to pass and is triggering failures. Switching the WeakReference by a SoftReference may seem a bit radical but is the most conservative way to fix this.

As a consequence of this change, the stress-tests for WeakReference-d objects (that were failing, as explained above) are no longer executed during the build. It could be said that such tests achieved what they were intended for: check for the validity of the WeakReference approach.

Closes #103.

carlosame commented 2 months ago

This change was reverted today, as further experimentation did not gave good results.