-
Notifications
You must be signed in to change notification settings - Fork 125
Description
During memory usage profiling tests of both CCache V2 and V3, I observed an increase in memory usage beyond expected levels, even when the cache size is capped at 1 million elements. This behavior is not observed in comparison with Ristretto, where the memory usage remains stable once the cache size limit is reached.
The increasing memory usage suggests a potential memory leak in CCache. Below are the test results for both CCache versions and Ristretto for comparison.
Steps to Reproduce:
- Set up a load test where the cache size is capped at 1 million elements.
- Insert items into the cache, gradually increasing up to 10 million items.
- Monitor the memory usage during the process.
CCache V2:
100k items -> Memory usage: 0.048 GB
1M items -> Memory usage: 0.500 GB
1.5M items -> Memory usage: 0.668 GB (cache len 1M, drops 500k)
2.5M items -> Memory usage: 1.046 GB (cache len 1M, drops 1.5M)
5M items -> Memory usage: 1.974 GB (cache len 1M, drops 4M)
10M items -> Memory usage: 3.829 GB (cache len 1M, drops 9M)
CCache V3:
100k items -> Memory usage: 0.046 GB
1M items -> Memory usage: 0.478 GB
1.5M items -> Memory usage: 0.645 GB (cache len 1M, drops 500k)
2.5M items -> Memory usage: 1.024 GB (cache len 1M, drops 1.5M)
5M items -> Memory usage: 1.951 GB (cache len 1M, drops 4M)
10M items -> Memory usage: 3.806 GB (cache len 1M, drops 9M)
Ristretto:
100k items -> Memory usage: 0.021 GB
1M items -> Memory usage: 0.220 GB
1.5M items -> Memory usage: 0.239 GB (cache len 1M, evictions 500k)
2.5M items -> Memory usage: 0.230 GB (cache len 1M, evictions 1.5M)
5M items -> Memory usage: 0.264 GB (cache len 1M, evictions 4M)
10M items -> Memory usage: 0.355 GB (cache len 1M, evictions 9M)
While Ristretto’s memory usage remains capped when the cache reaches 1 million items, CCache V2 and V3 show significant memory growth even though the cache length is restricted to 1 million items.
Expected Behavior:
Memory usage should stabilize once the cache reaches the set limit of 1 million items, similar to the behavior seen in Ristretto.
Actual Behavior:
Memory usage continues to increase in CCache V2 and V3, suggesting a potential memory leak; items dropped from the cache may not be properly cleaned up, resulting in continuous memory growth. If any further tests or logs are needed, I would be happy to provide them.