I am using libev to implement a media server and so far everything is smooth and easy. The only problem that I found is that libev seems to leak memory.

A simple program like this:

int main(int argc, char **argv)
{
        struct ev_loop *loop;

        loop = ev_default_loop(EVBACKEND_EPOLL);
        
        ev_default_destroy();
}


Running this program under valgrind will give me errors about unallocated blocks.

I use the command:

valgrind --leak-check=full --show-reachable=yes ./program_name

and the output is


==30474== Memcheck, a memory error detector.
==30474== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et
==30474== Using LibVEX rev 1804, a library for dynamic binary
==30474== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==30474== Using valgrind-3.3.0-Debian, a dynamic binary instrumentation framework.
==30474== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et
==30474== For more details, rerun with: -v
==30474==
--30474-- WARNING: unhandled syscall: 323
--30474-- You may be able to write your own handler.
--30474-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--30474-- Nevertheless we consider this a bug.  Please report
--30474-- it at http://valgrind.org/support/bug_reports.html.
==30474==
==30474== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 23 from 1)
==30474== malloc/free: in use at exit: 256 bytes in 1 blocks.
==30474== malloc/free: 4 allocs, 3 frees, 1,096 bytes allocated.
==30474== For counts of detected errors, rerun with: -v
==30474== searching for pointers to 1 not-freed blocks.
==30474== checked 110,268 bytes.
==30474==
==30474== 256 bytes in 1 blocks are still reachable in loss record 1 of 1
==30474==    at 0x4022AB8: malloc (vg_replace_malloc.c:207)
==30474==    by 0x4022BFC: realloc (vg_replace_malloc.c:429)
==30474==    by 0x4041357: ev_realloc_emul (ev.c:377)
==30474==    by 0x40429B1: array_realloc (ev.c:394)
==30474==    by 0x404408B: ev_signal_start (ev.c:2118)
==30474==    by 0x4044170: ev_default_loop_init (ev.c:1485)
==30474==    by 0x8049660: ev_default_loop (ev.h:433)
==30474==    by 0x8049630: main (video_server.c:9)
==30474==
==30474== LEAK SUMMARY:
==30474==    definitely lost: 0 bytes in 0 blocks.
==30474==      possibly lost: 0 bytes in 0 blocks.
==30474==    still reachable: 256 bytes in 1 blocks.
==30474==         suppressed: 0 bytes in 0 blocks.



I tried searching the cause but I am not familiar with libev internals yet. Any tips are appreciated.

regards,
Horacio

_______________________________________________
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to