cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: malloc/free.. callback functions

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Sun, 4 Apr 2004 23:45:51 +0200 (CEST)

On Fri, 2 Apr 2004, Seshubabu Pasam wrote:

> Can we add CURLOPT or a function for applications to register their own
> malloc/free/realloc/strdup callback functions. If these callback functions
> are not set, then CURL can fallback to the system calls. I know this is
> major change, but should be trivial. I can provide the patch if you are
> interested.

It couldn't be made with CURLOPT-options, since we've made numerous malloc()s
already by the time you'll get the first opportunity to use it.

But... if you're doing this to track or trace memory problems, won't you then
also be interested in hooks for other resource-using system functions libcurl
uses? Like fopen(), socket() etc? You couldn't do a fair leak detection
withotut them...

(I'm not totally against this suggestion, I just need to bounce around
thoughts and arguments before I decide anything.)

-- 
     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-04