-
Type: Task
-
Resolution: Duplicate
-
Priority: Critical - P2
-
None
-
Affects Version/s: 0.7
-
Component/s: None
-
Labels:
-
Environment:linux
I am using mongo TAILABLE cursor to read from mongod server. Notice that when the daemon is running for a long time , the process memory consumption keeps increasing. So used valgrind to check for memeory leak.
I get below out put from valgrind
-----------------------------------------------
==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==
--------------------------------------------------------------------------------------------
Following is the code snippet.
while(1)
{
if(mongo_check_connection (my_client) == MONGO_ERROR )
cursor = mongo_find( my_client,table_name , &b, bson_empty( &e ), 0, 0, MONGO_TAILABLE);
.....
}// end of mongo_check_connection (my_client)
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 );
}
------------------------------------------------------
Can you please advise what is the issue and how to fix?
I thought of upgrading to latest c-driver. But my application runs on 32 bit system.
Please assist.