Hi

regarding the System.gc() hack it's close to impossible to say how much
gets freed.
According to http://bugs.java.com/view_bug.do?bug_id=6668279
only unsed object references are discovered and _may_ get released.
AFAIK streams or file handles aren't closed by GC directly, but
sometimes when
the finalyze() is implemented this may work.
E.g. consider the Inflater *1) has a end() method which frees up the
off-heap
memory resources (because inflater uses zlib via JNI).
As long as such Inflater objects aren't garbage collected they can
occupy huge amount of memory.
To avoid such, its recommended to use try-finally constructs or
try-resources (Java7)
to explicitly release the resources.
Knowing this makes me even more wonder, why the comments in ShadeMojo:643
state that there are unclosed streams are freed.

*1) https://docs.oracle.com/javase/7/docs/api/java/util/zip/Inflater.html

Regards
Martin
@nitram509

Am 21.11.2015 um 11:13 schrieb Hervé BOUTEMY:
> [...]
> Do you have an idea of how much recoverable such leaks are with the 
> System.gc() hack?
> [...]


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to