libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] libmicrohttpd leaks memory


From: Christian Grothoff
Subject: Re: [libmicrohttpd] libmicrohttpd leaks memory
Date: Sun, 15 Jun 2008 09:14:35 -0600
User-agent: KMail/1.9.9

Dear Andreas,

valgrind reports the memory as "still reachable" -- so I doubt this is truly a 
leak.  What I suspect is happening is that your main application does not 
properly handle (some/all) connections and that they thus stay open 
(forever / until timeout -- if you specified one!).  

In order to diagnose your code try setting:

 1) a low connection limit (i.e., the maximum number of concurrent connections 
you expect) => you should see connection attempts starting to fail (if some 
connections are not closed even though you expect them to be)

2) a low timeout (1s) => you should see the number of blocks still reachable 
on exit go down 

3) a "notify completed" handler => is it being called?

Also, are you actually calling MHD_stop_daemon during shutdown? That is 
required for MHD to release all of its memory.

Happy hacking!

Christian


On Sunday 15 June 2008 08:22:33 am Andreas Røsdal wrote:
> Hello,
>
> I'm using libmicrohttpd as an embedded HTTP server.
> When investigating memory leaks with valgrind, I found
> something which seems to leak a lot of memory.
> It seems that 52 MB of memory has leaked when I tested it.
> Here is the output from valgrind:
>
>
> ==19624== 52,428,800 bytes in 50 blocks are still reachable in loss record
> 11 of 11
> ==19624==    at 0x4C21D06: malloc (in
> /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
> ==19624==    by 0x507F838: MHD_pool_create (memorypool.c:79)
> ==19624==    by 0x507E526: MHD_connection_get_fdset (connection.c:636)
> ==19624==    by 0x507EF7B: MHD_get_fdset (daemon.c:86)
> ==19624==    by 0x507F161: ??? (daemon.c:440)
> ==19624==    by 0x507F50C: ??? (daemon.c:541)
> ==19624==    by 0x58B401F: start_thread (in /lib64/libpthread-2.6.1.so)
> ==19624==    by 0x5B8E28C: clone (in /lib64/libc-2.6.1.so)
>
>
>
>
> Mvh,
> Andreas
> _______________________________________________
> libmicrohttpd mailing list
> address@hidden
> http://crisp.cs.du.edu/cgi-bin/mailman/listinfo/libmicrohttpd




reply via email to

[Prev in Thread] Current Thread [Next in Thread]