Re: Libev leaks memory

2008-05-15 Thread Marc Lehmann
On Thu, May 15, 2008 at 07:10:36PM +0900, hsanson <[EMAIL PROTECTED]> wrote:
> 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.

It doesn't:

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

Not sure what an unallocated block is, but there is no such thing in the
report you included.

> ==30474==definitely lost: 0 bytes in 0 blocks.
> ==30474==  possibly lost: 0 bytes in 0 blocks.

no memleaks.

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

In the report you included there is no memory leak. Did you misinterpret
valgrind output?

-- 
The choice of a   Deliantra, the free code+content MORPG
  -==- _GNU_  http://www.deliantra.net
  ==-- _   generation
  ---==---(_)__  __   __  Marc Lehmann
  --==---/ / _ \/ // /\ \/ /  [EMAIL PROTECTED]
  -=/_/_//_/\_,_/ /_/\_\

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


Re: Libev leaks memory

2008-05-15 Thread Brandon Black

hsanson wrote:


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.


[...]


==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==


[...]

I wouldn't worry about it too much.  Those 256 bytes are "leaked" just 
once, so it's not a real leak, it's more like "necessary memory that 
can't be easily free()'d up at exit".


-- Brandon

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


Libev leaks memory

2008-05-15 Thread hsanson


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