curl-library
Re: Possible memory leak in libcurl?
Date: Wed, 12 Jun 2002 13:18:41 +0200 (MET DST)
On Wed, 12 Jun 2002, Gautam Mani wrote:
> I am using libcurl 7.9.6 on solaris 8. I have attached some sample code
> which simulates the memory leak. I have verified the growing heap size with
> tools like pmap. Basically just change the url to correct values and point
> it to an empty directory. This is sufficient to reproduce the leak. Am I
> doing something wrong here? I would really appreciate it if anyone could
> give me some pointers on this.
Here's what I want you do do in order to track this down. I'm trying to be
generic here so that these instructions can be used in more cases than just
now:
1. Rebuild libcurl with -DMALLOCDEBUG (usually, rerunning configure with
--enable-debug fixes this). 'make clean' first, then 'make' so that
all files actually are rebuilt properly.
2. Add a line in your application code:
curl_memdebug("memdump");
This will make the malloc debug system output a full trace of all resource
using functions to the given file name.
3. Run your program as usual. Watch the 'memdump' file grow.
4. Make your program exit and use the proper libcurl cleanup functions etc.
So that all non-leaks are returned/freed properly.
5. Use the tests/memanalyze.pl perl script to analyze the memdump file:
tests/memanalyze.pl < memdump
This now outputs a report on what resources that were allocated but never
freed etc. This report is very fine for posting to the list!
-- Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/ _______________________________________________________________ Sponsored by: ThinkGeek at http://www.ThinkGeek.com/Received on 2002-06-12