cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: freeing up handles

From: emerson, jeff <emerson_jeff_at_EMC.com>
Date: Fri, 16 Apr 2004 10:14:55 -0400

Yes, I'm using https:// urls
Using OpenSSL version 0.9.7d

A windows handle is simply a 16/32 bit number that refers to an object. It's
similar to file handles used in standard 'C'. Very much like a pointer. You
get a handle by calling just about any windows function and then using it to
refer to the object. For example:

        HANDLE hThread;
        hThread = CreateThread(....);

// now I can refer to that thread via the hThread handle

        CloseHandle(hThread);

If you don't CloseHandle, the memory is not freed up. A few hundred
un-released handles won't cause much of a problem, but thousands will
eventually cause a crash.

It appears that the problem goes away when opening up only 1 instance of
curl and then always using that instance to perform curl operations. But
then another problem arises: if at any time, I open or close a VPN
connection, I get one of those two curl errors I mentioned earlier and some
handles are not destroyed after usage.

-----Original Message-----
From: Daniel Stenberg [mailto:daniel-curl_at_haxx.se]
Sent: Thursday, April 15, 2004 5:18 PM
To: libcurl development
Cc: emerson, jeff
Subject: RE: freeing up handles

On Thu, 15 Apr 2004, emerson, jeff wrote:

> 1. I'm using libcurl 7.11.1.
> 2. Statically linked.
>
> Since we last spoke, I've discovered it only occurs when using libcurl
> with SSL. I went back and used the standard version of libcurl -
> without ssl - and all worked well - the handles were released
> properly. But, when I use libcurl with ssl incorporated into it, the
> problem reappears.

And you are using https:// URLs to make the problem appear, right?

> If I open and close curl every time I want it to call it, a new handle
> is created, but never released.

What is a "handle" exactly? What kind of system call creates it?

> If I open curl only once and perform curl commands against that 1
> instance for the entire run of the program, it releases the handles
> properly.

Then it sounds like curl somehow causes this leak.

What OpenSSL version are you using?

-- 
     Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
      Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-04-16