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

Martin Buchholz martinrb at google.com
Fri May 20 00:51:51 UTC 2016


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!



More information about the core-libs-dev mailing list