[Bro] There is some memory leak in the Broccoli

john john_steve at 163.com
Wed Aug 20 01:42:09 PDT 2014

Hi Everyone ;
            These days i was writting some C code using Broccoli API to pull events from the Bro , and i run my program for about 10 hours to test it's stability , it worked fine , however i find another issue , it's seems there is some 
memory leak in my program , the ram usage by my program went to  157MB ,  in order to test where the memory leak problem comes from , i remove all my logical from the Broccoli client i wrote , and test it , finally i found that the mem-leak problem comes from the Broccoli API part ,
i use "valgrind [ http://valgrind.org/ ] " to check the mem-leak problem , it gave me some result like this:

==9063== 972 (104 direct, 868 indirect) bytes in 1 blocks are definitely lost in loss record 212 of 236
==9063==    at 0x4A0580F: calloc (vg_replace_malloc.c:618)
==9063==    by 0x4C1FB67: __bro_attrs_new (bro_attrs.c:52)
==9063==    by 0x4C2CA8A: __bro_sobject_create (bro_sobject.c:109)
==9063==    by 0x4C2D767: __bro_sobject_unserialize (bro_sobject.c:426)
==9063==    by 0x4C36217: __bro_table_val_read (bro_val.c:1682)
==9063==    by 0x4C2D7F5: __bro_sobject_unserialize (bro_sobject.c:435)
==9063==    by 0x4C35996: __bro_record_val_read (bro_val.c:1471)
==9063==    by 0x4C2D7F5: __bro_sobject_unserialize (bro_sobject.c:435)
==9063==    by 0x4C22E63: __bro_event_unserialize (bro_event.c:202)
==9063==    by 0x4C26858: io_process_serialization (bro_io.c:239)
==9063==    by 0x4C28AFB: __bro_io_process_input (bro_io.c:1043)
==9063==    by 0x4C1CB39: bro_conn_process_input (bro.c:781)
==9063== LEAK SUMMARY:
==9063==    definitely lost: 104 bytes in 1 blocks
==9063==    indirectly lost: 868 bytes in 16 blocks
==9063==      possibly lost: 0 bytes in 0 blocks
==9063==    still reachable: 102,002 bytes in 2,836 blocks
==9063==         suppressed: 0 bytes in 0 blocks
==9063== Reachable blocks (those to which a pointer was found) are not shown.
==9063== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==9063== For counts of detected and suppressed errors, rerun with: -v
==9063== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 4 from 4)

, and i seems the mem-leak problem come from the "bro_conn_process_input"[http://www.bro.org/sphinx/broccoli-api/broccoli_8h.html#a9ca697fd4737c4e0dc3f4a2bf98fa85c]"   function . 
I add the test program i wrote  as an attach file "memory_check.c " , you can compile it and run it , from the system monitor , the ram usage by the program is increasing . 
by the way , i am working the centos-6.5 64bit and gcc  version is "gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)"  and the system monitor is "gnome-system-monitor". 
if anyone know the cause to this problem , please tell me or correct the way i use the Broccoli API . 

Regards ,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ICSI.Berkeley.EDU/pipermail/bro/attachments/20140820/f874367e/attachment.html 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: memory_check.c
Url: http://mailman.ICSI.Berkeley.EDU/pipermail/bro/attachments/20140820/f874367e/attachment.c 

More information about the Bro mailing list