-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Hi,
When using a simple Cache built only specifying .weakKeys() and .weakValues() where keys and values are maintained by other data structures using strong refereneces and maintaining their own lifecycle, we observed a memory leak in production with Caffeine whilst not having observed it with Guava.
With this configuration, we are using the BoundedLocalCache with a LocalCacheFactory.WI and are creating NodeFactory.WW Nodes.
In the WW Node, there is a WeakValueReference which stores a strong reference to the key.
This strong reference caused a memory leak occupying 2/3 of the heap.
We did not setup a Cache#cleanUp task as we expected our cache to be sufficiently accessed to perform its maintenance tasks without it.
The Cache gets about 11 writes per second in production of mainly unique keys, i.e we are using it as a Store, not as a Cache.
I guess our use case does not really fit in and that we need to schedule the cleanUp of the Cache every now and then.
If you need additional details, feel free to ask.
Best regards,
Dominique