From: Amit R. <am...@ya...> - 2011-03-08 01:08:40
|
Hi jsoncpp-devel, I am developing application code that uses jsoncpp-0.5.0 on a freebsd6 server compiled with gcc version 2.95.3 20010315 (release). I am seeing that the heap memory of the process is constantly growing when a large json stucture with several thousands of entries is parsed. The process grows to over 500 MB in size and eventually dumps core with a seg fault. Memory leak detection tools are reporting a memory leak with the following stack trace. The application code's entry point to the jsoncpp library is through the Json::Reader::parse() call. It seems that the underlying std::map under Value::Value is not deleted properly in this case. | allocation size per-call (min max avg): 4 94 27 | most recent stack trace: #0 0x213caea5 in malloc () from /usr/lib32/compat/libc.so.4 #1 0x234810a3 in Json::DefaultValueAllocator::duplicateStringValue ( this=0x23491f9c, value=0x12c4eb0 "address", length=4294967295) at json_value.cpp:85 #2 0x23479917 in Json::Value::Value (this=0xffffb6a0, other=@0xffffb6ec) at json_value.cpp:437 #3 0x23479d73 in Json::Value::operator= (this=0x11d6130, other=@0xffffb6ec) at json_value.cpp:510 #4 0x23470484 in Json::Reader::decodeString (this=0x113f53c, token=@0xffffb744) at json_reader.cpp:652 #5 0x2346dbee in Json::Reader::readValue (this=0x113f53c) at json_reader.cpp:220 #6 0x2346ec97 in Json::Reader::readObject (this=0x113f53c, tokenStart=@0xffffb814) at json_reader.cpp:510 #7 0x2346dbc1 in Json::Reader::readValue (this=0x113f53c) at json_reader.cpp:211 #8 0x2346f2c7 in Json::Reader::readArray (this=0x113f53c, tokenStart=@0xffffb8b4) at json_reader.cpp:554 #9 0x2346dbd0 in Json::Reader::readValue (this=0x113f53c) at json_reader.cpp:214 #10 0x2346ec97 in Json::Reader::readObject (this=0x113f53c, tokenStart=@0xffffb984) at json_reader.cpp:510 #11 0x2346dbc1 in Json::Reader::readValue (this=0x113f53c) at json_reader.cpp:211 #12 0x2346f2c7 in Json::Reader::readArray (this=0x113f53c, tokenStart=@0xffffba24) at json_reader.cpp:554 #13 0x2346dbd0 in Json::Reader::readValue (this=0x113f53c) at json_reader.cpp:214 #14 0x2346ec97 in Json::Reader::readObject (this=0x113f53c, tokenStart=@0xffffbaf4) at json_reader.cpp:510 #15 0x2346dbc1 in Json::Reader::readValue (this=0x113f53c) at json_reader.cpp:211 #16 0x2346ec97 in Json::Reader::readObject (this=0x113f53c, tokenStart=@0xffffbbc4) at json_reader.cpp:510 #17 0x2346dbc1 in Json::Reader::readValue (this=0x113f53c) at json_reader.cpp:211 #18 0x2346d8d6 in Json::Reader::parse (this=0x113f53c, beginDoc=0x14fc010 "{\"contacts\":{\"start\":0,\"count\":618,\"total\":618,\"uri\":\"http://social.yahooapis.com/v1/user/3N74ASGDFNOAJUBXOFSDDZZEYQ/contacts\",\"contact\":[{\"uri\":\"http://social.yahooapis.com/v1/user/3N74ASGDFNOAJUBXOF"..., endDoc=0x1599ebd "", root=@0xffffbdf0, collectComments=true) at json_reader.cpp:172 #19 0x2346d696 in Json::Reader::parse (this=0x113f53c, document=@0xffffbd1c, root=@0xffffbdf0, collectComments=true) at json_reader.cpp:129 #20 0x231cff6e in ymmaddbk::AddressBookClient::parseContactsInJson ( this=0x113f500, text=@0xffffbd1c, root=@0xffffbdf0) at AddressBookClient.cc:582 #21 0x231c3a21 in ymmaddbk::AddressBookClient::getAllRecords (this=0x113f500, ytcookie=@0x10f7688, root=@0xffffbdf0) at AddressBookClient.cc:144 #22 0x231c70c2 in ymmaddbk::AddressBookClient::getNickNames (this=0x113f500, ytcookie=@0x10f7688, nickNames=@0xffffbf4c) at AddressBookClient.cc:313 #23 0x231e4df3 in ymmaddbk::ymmab::getNickNames (this=0xffffbf58, ytcookie=@0x10f7688, nickNames=@0xffffbf4c) at ymmab.cc:347 #24 0x22c8dac0 in push::pushNotify::valAndInitialize (this=0x10f7680, rawData=@0xffffc060, len=@0xffffc04c) at PushNotifier.cc:384 #25 0x22c8a696 in push::pushNotifyWrapper::valAndInitialize (this=0x113e220, rawData=@0xffffc060, len=@0xffffc04c) at PushNotifier.cc:182 #26 0x22c9425a in MsgrPushNotifyProcess ( consumer=0x1064838 "MsgrPushNotify.so /home/y/conf/ymmpush/pushConsumerApns.xml", entry=0x1048d10) at PushNotifier.cc:653 #27 0x2114fca2 in yreplLogConsSO::callProcess (this=0x10dd3c0, consumer=0x1064838 "MsgrPushNotify.so /home/y/conf/ymmpush/pushConsumerApns.xml", entry=0x1048d10) at logConsSO.cc:135 #28 0x01023212 in processEntry (entry=0x1048cd0) at txLogReader.cc:1533 #29 0x010195a5 in flushEntryBuffer (unreadLast=false) at txLogReader.cc:335 #30 0x0101a271 in addEntryToBuffer (entry=0x11790a0) at txLogReader.cc:512 #31 0x0101d9db in main (argc=2, argv=0xffffc330) at txLogReader.cc:10 Is this a known issue? Has anyone encountered memory leaks with jsoncpp-0.5.0? If someone on the mailing list Has run into this problem please let me know. Thanks, amit Here is some additional data about the server... FreeBSD cache101a.a1.rest.msg.sp1.yahoo.com 6.3-YAHOO-20080603 FreeBSD 6.3-YAHOO-20080603 #0: Wed Jun 4 08:19:43 PDT 2008 jh...@fb...:/home/src/sys/amd64/compile/YAHOO amd64 |