My mongod command
mongod --wiredTigerCacheSizeGB 5
In practice, I'm getting mongo instance to use even up to 8.6 GB (on a VM with 50 GB RAM)
Indexes are using about 100 MB (checked with
MALLOC: 3776745552 ( 3601.8 MiB) Bytes in use by application MALLOC: + 4744544256 ( 4524.8 MiB) Bytes in page heap freelist MALLOC: + 20067616 ( 19.1 MiB) Bytes in central cache freelist MALLOC: + 3584128 ( 3.4 MiB) Bytes in transfer cache freelist MALLOC: + 12470800 ( 11.9 MiB) Bytes in thread cache freelists MALLOC: + 22544384 ( 21.5 MiB) Bytes in malloc metadata MALLOC: ------------ MALLOC: = 8579956736 ( 8182.5 MiB) Actual memory used (physical + swap) MALLOC: + 29933568 ( 28.5 MiB) Bytes released to OS (aka unmapped) MALLOC: ------------ MALLOC: = 8609890304 ( 8211.0 MiB) Virtual address space used MALLOC: MALLOC: 21650 Spans in use MALLOC: 59 Thread heaps in use MALLOC: 4096 Tcmalloc page size
The server had been running for 3 days.
How can I tell why mongo is consuming more memory than the allowed cache size? Is there any way to manually free up the "page heap freelist"?
The command output is recommending
Call ReleaseFreeMemory() to release freelist memory to the OS, but I don't think I can actually do that out of the process.
MongoDB version is
4.4.1, I'm using
mongo:4.4.1-bionic docker image.