-
Type: Improvement
-
Resolution: Won't Fix
-
None
-
Affects Version/s: None
-
Component/s: None
-
Environment:linux
*Location*: http://www.mongodb.org/about/support/
*User-Agent*: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11
*Referrer*: http://www.mongodb.org/
*Screen Resolution*: 1360 x 768
*repo*: mongodb-www-about
*source*: support
Hi,
I am using libmongoc.so.0.7.0 with tail functionality to read from mongodb.
Valgrind shows leak in this as follows.
------------------------------------------------------------------------------------------------
==00:00:08:55.814 17673== 151,848 (123,120 direct, 28,728 indirect) bytes in 513 blocks are definitely lost in loss record 270 of 272
==00:00:08:55.815 17673== at 0x4C229FE: malloc (vg_replace_malloc.c:291)
==00:00:08:55.815 17673== by 0x4E3104C: bson_malloc (bson.c:952)
==00:00:08:55.815 17673== by 0x4E3735F: mongo_find (mongo.c:1243)
==00:00:08:55.815 17673== by 0x40482A: start_threshold_mongo_log_tailable (mongotosqlite_main.c:481)
==00:00:08:55.815 17673== by 0x619AFC6: start_thread (in /lib64/libpthread-2.8.so)
==00:00:08:55.815 17673== by 0x6A097AC: clone (in /lib64/libc-2.8.so)
==00:00:08:55.815 17673==
==00:00:08:55.815 17673== 745,644 (599,280 direct, 146,364 indirect) bytes in 2,497 blocks are definitely lost in loss record 271 of 272
==00:00:08:55.815 17673== at 0x4C229FE: malloc (vg_replace_malloc.c:291)
==00:00:08:55.815 17673== by 0x4E3104C: bson_malloc (bson.c:952)
==00:00:08:55.815 17673== by 0x4E3735F: mongo_find (mongo.c:1243)
==00:00:08:55.815 17673== by 0x4050A8: start_mongo_log_tailable (mongotosqlite_main.c:724)
==00:00:08:55.815 17673== by 0x619AFC6: start_thread (in /lib64/libpthread-2.8.so)
==00:00:08:55.815 17673== by 0x6A097AC: clone (in /lib64/libc-2.8.so)
==00:00:08:55.815 17673==
----------------------------------------------------------------------------------------------
code snippet.
-------------------
while(1)
{
if(mongo_check_connection (&client_apslog) == MONGO_ERROR )
{
mongo_destroy (&client_apslog);
if (mongo_client (&client_apslog, "127.0.0.1", 27017) != MONGO_OK)
}
cursor = mongo_find( &client_apslog,table_name , &b, bson_empty( &e ), 0, 0, MONGO_TAILABLE);
if(cursor != NULL)
{
while(mongo_cursor_next( cursor ) == MONGO_OK)
// end of while(mongo_cursor_next
bson_destroy( &b );
bson_init( &b );
bson_append_start_object( &b, "_id" );
bson_append_oid( &b, "$gt", &id );
bson_append_finish_object( &b );
bson_finish( &b );
}//end of cursor != NULL
}
Can you please advise what is wrong.
I do call bson_destroy(&) at end of while(mongo_cursor_next( cursor ) == MONGO_OK)