Memory is not released on dispose causing OOM
Hi Folks!
I am using [email protected] + [email protected] like below:
Value - huge object, generated during Server Side Rendering.
The problem:
- memory is not released on dispose
- adding new items evict old entities but the total memory is slowly growing, causing OOM
- ttlAutopurge: true expires the entities but does not release the memory
Possible way to release memory:
- manually clear the cache inside setTimeout() which is not the option
What is the best memory releasing strategy?
Thanks in advance!
I`d like to add that I use express.js app. I simulate high load by executing simple HTTP request like setTimeout(() => {executor()}, 100).
From the logs I see that not all LRU items are properly evicted.
Every time all the items are supposed to be expired and pruned but a few are still in the memory.
Identified that the items are not properly evicted due to updateAgeOnGet & updateAgeOnHas presence.
@OverLord561 did you manage to fix or properly workaround the issue? I see:
- https://github.com/isaacs/node-lru-cache/issues/227 which says setting
maxSizeshould fix it - might be a V8 bug https://github.com/isaacs/node-lru-cache/issues/331#issuecomment-2060094728 (V8 bug still open, created Apr 2024)