co-mongo icon indicating copy to clipboard operation
co-mongo copied to clipboard

Memory Consumption in insert method

Open thiyaga123 opened this issue 9 years ago • 3 comments

I am executing below code around 1Million times and Memory consumed by "insert" gradually get increased and program aborted when all memory consumed. var item = yield productsCollection.insert( p );

can you fix this issue ?

Below is the screenshot of heapdump and its all filled with db objects. If i comment out insert code, loop runs fine till 10 million

http://tinypic.com/r/2qx6jrd/8

thiyaga123 avatar Apr 23 '15 11:04 thiyaga123

Hmm, the code is actually pretty simple: https://github.com/thomseddon/co-mongo/blob/master/lib/collection.js#L59-L69

Would you mind having a look at it?

thomseddon avatar May 10 '15 16:05 thomseddon

@thiyaga123 do you have a code sample? This can happen easily as a result of promise chains or tail call's, but since most of that is under the hood of co and co-mongo in this case, it'd be useful to see the whole loop. Are there excess closures being created in your loop?

jbielick avatar Jul 26 '15 16:07 jbielick

Would be very interested to see a minimal example of this bug

thomseddon avatar Mar 05 '16 17:03 thomseddon