I'm having a problem with virtual memory usage using MongoDB on a server. NOTE: I have only a local user account without root privs.
The server's VM limit (from ulimit -v) is 120MB.
With an empty database, MongoDB is reporting 100MB of virtual memory used.
> db.serverStatus().mem
{
"bits" : 32,
"resident" : 23,
"virtual" : 100,
"supported" : true,
"mapped" : 0
}
As soon as I try to create my first data entry (through db.addUser in the admin database), it's failing with an out of memory error.
done allocating datafile DBPATH/admin.0, size: 16MB, took 0.244 secs
ERROR: mmap() failed for DBPATH/ admin.0 len:16777216 errno:12 Cannot allocate memory
I understand that with a small VM limit and 32-bit mongodb, I'm not going to be able to create gigantic databases, but that's OK. I don't need gigantic databases.
What I can't understand is why it is using so much virtual memory out of the gate, and why it can't create a single 16MB database table.
I have read the accepted answer on this other question. It clarified how mongodb uses virtual memory, but it didn't help me to understand what's going wrong here.