karlseguin / ccache

A golang LRU Cache for high concurrency
MIT License
1.27k stars 118 forks source link

Memory leak during cleanup #81

Open bubblesupreme opened 1 year ago

bubblesupreme commented 1 year ago

There is a problem here. Buckets and list cleanup must be synchronized. Otherwise, if we concurrently call Set we may end up with an empty list and non-empty buckets. In this case we got memory leak like this. There is a small leak, but it's still there. At the next cleanup, these objects will be removed, but new leaking objects will appear again.