RFR: 8156484: ZipFile retains too much native memory from caching Inflaters

Peter Levart peter.levart at gmail.com
Fri May 20 14:31:05 UTC 2016


Hi Martin,


On 05/20/2016 02:51 AM, Martin Buchholz wrote:
> On Thu, May 19, 2016 at 7:29 AM, Peter Levart <peter.levart at gmail.com> wrote:
>> So Martin, what do you think?
> I studied your code and we are fundamentally in agreement!
> ... Except for need for periodic cleanup of the cache...
> Maybe we should do
> CompletableFuture.runAsync(purgeCache,
> CompletableFuture.delayedExecutor(1, SECONDS))
> as a periodic task while cache is non-empty instead of my strategy of
> relying on a weak reference.
>
> Purging a cache on quiescence in the optimal way seems to be a hard problem.
> Time to write ObjectPool<T> (as many others have done before us)?
>
> ObjectPool(Supplier<T> factory,  Consumer<T> releaser, maxCacheSize,
> keepAliveTime)
>
> Except this time we'll do it right!  With jdk9 machinery!

Something like the following?

http://cr.openjdk.java.net/~plevart/jdk9-dev/ZipFile_Inflater.cleanup/webrev.02/

I still must debug the cause of OutOfMemoryError in 
java/util/zip/ZipFile/TestZipFile.java.

Regards, Peter




More information about the core-libs-dev mailing list