[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Libevent memory leak?



Hi Mark,

I tried the following:

./configure --disable-debug-mode
make clean all
copy my libs to the right places and compile test_event.c

This is the result:

$ valgrind --leak-check=full --show-reachable=yes ./test_event.exe
==28671== Memcheck, a memory error detector
==28671== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==28671== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info
==28671== Command: ./test_event.exe
==28671==Â
==28671==Â
==28671== HEAP SUMMARY:
==28671== Â Â in use at exit: 80 bytes in 2 blocks
==28671== Â total heap usage: 40 allocs, 38 frees, 4,350 bytes allocated
==28671==Â
==28671== 40 bytes in 1 blocks are still reachable in loss record 1 of 2
==28671== Â Âat 0x4C2815C: malloc (vg_replace_malloc.c:236)
==28671== Â Âby 0x4D1309: evthread_posix_lock_alloc (evthread_pthread.c:48)
==28671== Â Âby 0x4C8463: evsig_global_setup_locks_ (signal.c:440)
==28671== Â Âby 0x4B50F7: event_global_setup_locks_ (event.c:2832)
==28671== Â Âby 0x4D10FC: evthread_use_pthreads (evthread_pthread.c:187)
==28671== Â Âby 0x404145: main (test_event.c:6)
==28671==Â
==28671== 40 bytes in 1 blocks are still reachable in loss record 2 of 2
==28671== Â Âat 0x4C2815C: malloc (vg_replace_malloc.c:236)
==28671== Â Âby 0x4D1309: evthread_posix_lock_alloc (evthread_pthread.c:48)
==28671== Â Âby 0x4C6B93: evutil_secure_rng_global_setup_locks_ (evutil_rand.c:106)
==28671== Â Âby 0x4B510E: event_global_setup_locks_ (event.c:2834)
==28671== Â Âby 0x4D10FC: evthread_use_pthreads (evthread_pthread.c:187)
==28671== Â Âby 0x404145: main (test_event.c:6)
==28671==Â
==28671== LEAK SUMMARY:
==28671== Â Âdefinitely lost: 0 bytes in 0 blocks
==28671== Â Âindirectly lost: 0 bytes in 0 blocks
==28671== Â Â Âpossibly lost: 0 bytes in 0 blocks
==28671== Â Âstill reachable: 80 bytes in 2 blocks
==28671== Â Â Â Â suppressed: 0 bytes in 0 blocks
==28671==Â
==28671== For counts of detected and suppressed errors, rerun with: -v
==28671== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)


As far as I can see, if I disable debug mode, only this line:
2830 EVTHREAD_SETUP_GLOBAL_LOCK(_event_debug_map_lock, 0);
is ignored.

ToÂcompletely get rid of leaks, I would have to disable thread support (which in my programs I use).Â

Maybe I'm missing something? It's
./configure --disable-debug-mode
enough to disable debug, or there are more flags which I missed?

Thank you,
Andrei

On Mon, Jul 11, 2011 at 6:30 PM, Mark Ellzey <mthomas@xxxxxxxxxx> wrote:
int
event_global_setup_locks_(const int enable_locks)
{
#ifndef _EVENT_DISABLE_DEBUG_MODE
   ÂEVTHREAD_SETUP_GLOBAL_LOCK(_event_debug_map_lock, 0);
#endif

is your issue. so yeah, --disable-debug-mode will fix that problem.

On Mon, Jul 11, 2011 at 11:26:28AM -0500, Mark Ellzey wrote:
> On Mon, Jul 11, 2011 at 06:06:22PM +0200, Andrei Chirila wrote:
> > Hello,
> >
> > I just tried with the latest:
> >
>
> Try compiling with --disable-debug-mode
> ***********************************************************************
> To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
> unsubscribe libevent-users  Âin the body.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users  Âin the body.



--
Mobile: +49 151 42647382
e-Mail: andreich@xxxxxxxxx