[CXX-304] A large of Insertions maybe catch memory leak. Created: 12/Aug/14  Updated: 14/Aug/14  Resolved: 14/Aug/14

Status: Closed
Project: C++ Driver
Component/s: API
Affects Version/s: legacy-0.0-26compat-2.6.3
Fix Version/s: legacy-0.0-26compat-2.6.4

Type: Bug Priority: Blocker - P1
Reporter: jebin Assignee: Samantha Ritter (Inactive)
Resolution: Done Votes: 0
Labels: legacy-cxx
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File main.cpp    

 Description   

When I use cxx driver to insert a large of documents, the memory of program is growing fast until 2GB. Then the program crashed.
I just test the insert function. When I get rid of the insertion code, the program run normally.
Has the insert function any memory leak problem?
ie: like this:
while(1) m.insert("testdata", BSON("testdata" << 123));



 Comments   
Comment by jebin [ 14/Aug/14 ]

Thanks Andrew. It's my compilation problem. Now i rebuild and fix the problem. Thanks again

Comment by Andrew Morrow (Inactive) [ 13/Aug/14 ]

Hi jebin

One thing to note: the build process you are using (documented here: https://github.com/mongodb/mongo-cxx-driver/wiki/Download%20and%20Compile#building-multiple-windows-library-variants) is only applicable on the 'legacy' branch. The 26compat branch does not offer the functionality required to support this. On the 26compat branch, all of these builds result in equivalent filenames for the libraries (both shared and dynamic). So only your last build (the one with --dynamic-windows) has any effect.

Comment by jebin [ 13/Aug/14 ]

sorry Ritter, now I attached my test file. Version of Mongodb is v2.6.3-64bit. The cxx driver's version i use is in branch 26compat. And i compiled with boost1.55, 32bit, vs2013 and windows7-64bit .

The scons command following:

scons --32 --prefix="K:\mongo-cxx-driver" --cpppath="K:\boost_1_55_0" --libpath="K:\boost_1_55_0\lib32-msvc-12.0" install-mongoclient
scons --32 --prefix="K:\mongo-cxx-driver" --cpppath="K:\boost_1_55_0" --libpath="K:\boost_1_55_0\lib32-msvc-12.0" install-mongoclient --dbg=on
scons --32 --prefix="K:\mongo-cxx-driver" --cpppath="K:\boost_1_55_0" --libpath="K:\boost_1_55_0\lib32-msvc-12.0" install-mongoclient --dynamic-windows --sharedclient
scons --32 --prefix="K:\mongo-cxx-driver" --cpppath="K:\boost_1_55_0" --libpath="K:\boost_1_55_0\lib32-msvc-12.0" install-mongoclient --dynamic-windows --sharedclient --dbg=on

And now i found that if insert vector<BSONObj>, the memory growing slower than insert every BSONObjs.

If the test file cant catch the problem for you, plz tell me what environment you used.

Thanks a lot !!!

Comment by Samantha Ritter (Inactive) [ 12/Aug/14 ]

Hi jebin,

Could you please give me some more information about this problem? What version of MongoDB are you running against? Also, could you please provide a more complete code example that causes this problem for you? I haven't been able to reproduce this problem yet.

Thanks!

Generated at Wed Feb 07 21:58:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.