Memory Leak in nng_rep0_open
VishalGujela opened this issue · 2 comments
Hi Im facing this memory leak while starting my pubusb socket where im passing the address of nng_socket sock
==333237== HEAP SUMMARY:
==333237== in use at exit: 11,156 bytes in 83 blocks
==333237== total heap usage: 409 allocs, 326 frees, 197,215 bytes allocated
==333237==
==333237== 272 bytes in 1 blocks are possibly lost in loss record 12 of 22
==333237== at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==333237== by 0x40149DA: allocate_dtv (dl-tls.c:286)
==333237== by 0x40149DA: _dl_allocate_tls (dl-tls.c:532)
==333237== by 0x4871322: allocate_stack (allocatestack.c:622)
==333237== by 0x4871322: pthread_create@@GLIBC_2.2.5 (pthread_create.c:660)
==333237== by 0x12A796: nni_plat_thr_init (in /home/amantya/Oam_recovery/hm)
==333237== by 0x127D1F: nni_thr_init (in /home/amantya/Oam_recovery/hm)
==333237== by 0x12B596: nni_posix_pollq_create (in /home/amantya/Oam_recovery/hm)
==333237== by 0x12B60E: nni_posix_pollq_sysinit (in /home/amantya/Oam_recovery/hm)
==333237== by 0x12A997: nni_plat_init (in /home/amantya/Oam_recovery/hm)
==333237== by 0x11C990: nni_init (in /home/amantya/Oam_recovery/hm)
==333237== by 0x1233A7: nni_sock_open (in /home/amantya/Oam_recovery/hm)
==333237== by 0x12D790: nni_proto_open (in /home/amantya/Oam_recovery/hm)
==333237== by 0x12D758: nng_rep0_open (in /home/amantya/Oam_recovery/hm)
If you're using Valgrind, you should call nng_fini()
at the end of your tests otherwise you'll get spurious reports.
See the comments here:
Lines 212 to 221 in e46b41a
Thanks @shikokuchuo
After using nng_fini there is no memory leak report in valgrind.