且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

缓存破坏后,Ignite不会释放内存

更新时间:2023-02-02 21:10:06

对我有用的唯一方法是调用Cache#removeAll + Ignite#destroyCache + Ignite#createCache.这样,我就可以使用新的/更新的配置创建新的缓存,并在创建新的缓存之前解锁过时的堆外内存.这样可以根据需要缩小和增加内存量.如果您知道自己有绝对最大值.无需缩小它,您只需配置off-heap-max-memory(+ EvictionPolicy和ExpiryPolicy),然后将重新使用未使用的空间(您将无法摆脱Off-heap-max-memory,但是缓存也不会缩小).

The only way which worked for me is to call Cache#removeAll + Ignite#destroyCache + Ignite#createCache. With that I was able to create a new cache with a new/updated config and unlocking the outdated off-heap memory before creating the new cache. That allows to shrink and grow the amount of memory as you need. If you know that you have an absolute max. and no need to shrink it, you can just configure the off-heap-max-memory (+ EvictionPolicy and ExpiryPolicy) and the unused space will be re-used (you won't get over off-heap-max-memory, but the cache also won't shrink).