cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: memory leak? help needed

From: Tom Jerry <catod6_at_gmail.com>
Date: Thu, 12 Oct 2006 12:44:56 +0200

Ok, I did this and now I have the memory debug file of my application.
I tested a single POST request, got response and then shut down.

Since I'm running on windows, I've downloaded ActivePearl and run the
following commad:

memanalyze.pl my_curl_debug.log

I saw nothing happens. I guess it mean there are no leaks.

Then I added the -t flag (file is attached).
At the last line I get:
FREE: 33800 bytes freed, left allocated: 0 bytes

I attached the raw memory file for you to see and the trace analysis file .

So after analyzing the debug files, I believe that the memory is freed when
my application goes down (I also see it in my own prints), and there aren't
any leaks eventually.

But during my service operation, the memory is always growing.
Two places, for example, that I saw (using a debugger) an allocation that is
not freed when sending a POST request are:
  1) conn = (struct connectdata *)calloc(sizeof(struct connectdata), 1); -
url.c 2614
  2) conn->pathbuffer=(char *)malloc(urllen+2); - url.c 2674
This memory is probably deallocated when my service goes down, but is is not
deallocated after the POST request ends.
Since my application is a service (which should never go down), I have a
serious problem.

Do you have any idea for a solution?

On 10/12/06, Daniel Stenberg <daniel_at_haxx.se> wrote:
>
> On Thu, 12 Oct 2006, Tom Jerry wrote:
>
> > I tried doing what you suggested, but I have a weird problem - my
> > application doesn't link because it cannot find the curl_memdebug
> function:
> > error LNK2001: unresolved external symbol "__declspec(dllimport) void
> > __cdecl curl_memdebug(char const *)" (__imp_?curl_memdebug@@YAXPBD_at_Z)
> > ..\..\..\bin/XmlHttpMc.exe : fatal error LNK1120: 1 unresolved externals
> >
> > I made sure I'm linking with the new created libcurl (with the CURLDEBUG
> > flag), and even inspected the dll using 'depends' tool and saw that the
> > function do exist and it is exported. Any ideas?
>
> I'm guessing you might need to add a line like
>
> CURL_EXTERN void curl_memdebug(const char *logname);
>
> in the public header file (include/curl/curl.h) so that your app will use
> it
> correctly.
>
> --
> Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
>

Received on 2006-10-12