BUG: Dropped and removed documents, are not removed from memory! version v6.0.5

Hello guys, I’m running MongoDB Enterprise version v6.0.5, storage engine: inMemory.
I’ve created a collection around 7GB in size, and after I removed all the documents, I noticed still my memory usage is around 7GB. After stopping MongoDB, I noticed the memory usage went to normal - so this data was purged only after restart. I’ve also tried to drop collection - and even waited over 24hrs to see if files will be cleaned from memory - but it was still stuck in memory, again after mongod restart it was cleaned and memory usage was ok.
This is a big issue, because I’m working with a large size of data, and I’m deleting some entires every few days, this will lead to memory leak - because I will delete my data, but memory usage will be still the same.

Could you please test this and help?
Best,
David

Once deleted , Mongodb may not just return those memory back to OS. Very likely those memory will be used by your new incoming data and releasing-then-reallocating memory takes time.

The database may also pre-allocate memory before they are actually needed, this is purely to improve performance. Many software do this.

Mongodb uses tcmalloc lib for memory management (based on manual), so check it out.

Thanks a lot

Best,
David