|
Just tested on Linux (Ubuntu 12.04, x64) with similar results.
ben@linux-mobile:~/projects/mongo$ ./mongo
|
MongoDB shell version: 2.0.4
|
connecting to: test
|
> // Res mem is 27mb
|
> result = {};
|
{ }
|
> result2 = {};
|
{ }
|
> for (i=0;i<640000;i++) {
|
... result[i] = i * 3 % i;
|
... result2[i] = result + 'aaaaaaaaaaaaaaaaaaaaaaaaa';
|
... db.isMaster()
|
... }
|
{ "ismaster" : true, "maxBsonObjectSize" : 16777216, "ok" : 1 }
|
> // Res mem is 285MB
|
> result = 0;
|
0
|
> result2 = 0;
|
0
|
> i = 0
|
0
|
> gc()
|
> // Res mem is 258MB (note 258MB vs. 285MB)
|
The following test is slightly modified to iterate 6.4M times vs. 640k, which should produce an OOM error from the JS engine (at which point RSS is ~1GB). Mostly tested on MacOS. For some reason this didn't give an OOM the first time I ran it on Linux (mem capped out at ~1GB, but it kept running).
result = {};
|
result2 = {};
|
for (i=0;i<6400000;i++) {
|
result[i] = i * 3 % i;
|
result2[i] = result + 'aaaaaaaaaaaaaaaaaaaaaaaaa';
|
db.isMaster()
|
}
|
>
|
I've been seeing this produce an OOM error when you run the gc() command, and it doesn't free up anything.
|