-
|
Hi, I'm wondering whether Caffeine has a default internal memory limit or maximum size constraint. Let me first explain the context of why I'm asking this question. Recently, I noticed what seemed like a memory leak on a server using Caffeine. After some investigation, I realized that the issue was due to not setting any expiration policy on the cache. Since the server was storing cache entries in a linear fashion, stale data kept accumulating, causing a steady increase in memory usage. I resolved the issue by adding an expiration policy, but what puzzled me was that at some point, memory usage stopped increasing and remained steady, even though I hadn't configured any maximumSize or size-bound eviction in Caffeine. This behavior made me wonder whether Caffeine has a default maximum size or internal memory limit. However, after checking the documentation and source code, I couldn't find any clear evidence of such a default. If Caffeine does impose some internal default limit, then this memory behavior would make sense. But if not, I might need to look elsewhere for the cause. So, my question is: Does Caffeine have a built-in memory size limit or default maximum size when none is explicitly configured? If yes, what logic or part of the source code should I look into to understand this behavior? Any insights would be really helpful. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Nope, there is no default bounding if you have no policy (maximum, expiration, soft/weak). If you have soft values then the garbage collector is responsible to decide when to evict in low memory situations, but that can cause its own headaches so not typically recommended. I guess something else helped you in this case. |
Beta Was this translation helpful? Give feedback.
Nope, there is no default bounding if you have no policy (maximum, expiration, soft/weak). If you have soft values then the garbage collector is responsible to decide when to evict in low memory situations, but that can cause its own headaches so not typically recommended. I guess something else helped you in this case.