maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin W. Kirst" <x.nitram...@gmail.com>
Subject Re: to delete windows build ?
Date Sat, 21 Nov 2015 11:29:33 GMT
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-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Mime
View raw message