cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_easy_cleanup question

From: Andy hobbs <andy_at_trogs.org.uk>
Date: Fri, 24 Sep 2004 09:03:45 +0100

Hi,

Generally when you get segfaults occurring in _int_free() (or any other
part or the malloc package) it is due to Mallocs tables being corrupt.

This can be caused in all sorts of ways the two most common being:
* writing to an address incorrectly (e.g. uninitialised pointer
* freeing memory that was not allocated in the first place (only
possible if the address being freed is in you address space)

I suggest you use a library like mss (memory supervision system) to have
a look at what is going on in your program. I've attached a script I've
written for analysing the mss out put which makes it very quick and easy
for finding problems like these.

http://hem1.passagen.se/blizzar/mss/index.html

hope that helps

Andy

On Thu, 2004-09-23 at 19:33, Tarendash, David wrote:
> Has anyone had problems with curl_easy_cleanup() ??? For some reason
> it is coring on my RH-AS-3.0 box. I understand that my explanation is
> vague, but, I cant reproduce it, it just periodically happens. I've
> run top and other ps commands, and the system seems to be stable(ie
> not out of memory). If you notice, the pointer being passed into
> curl_easy_cleanup() appears to be a valid one.
>
> Here is the stack trace:
>
> (gdb) where
> #0 0xb6fdbcb0 in _int_free () from /lib/tls/libc.so.6
> #1 0xb6fdac88 in free () from /lib/tls/libc.so.6
> #2 0xb6e6fe0d in CRYPTO_free () from /lib/libcrypto.so.4
> #3 0xb6eaeca9 in BUF_MEM_free () from /lib/libcrypto.so.4
> #4 0xb6ecdbaf in X509_NAME_dup () from /lib/libcrypto.so.4
> #5 0xb6ed350a in ASN1_item_ex_free () from /lib/libcrypto.so.4
> #6 0xb6ed35b2 in ASN1_template_free () from /lib/libcrypto.so.4
> #7 0xb6ed342b in ASN1_item_ex_free () from /lib/libcrypto.so.4
> #8 0xb6ed35b2 in ASN1_template_free () from /lib/libcrypto.so.4
> #9 0xb6ed342b in ASN1_item_ex_free () from /lib/libcrypto.so.4
> #10 0xb6ed3290 in ASN1_item_free () from /lib/libcrypto.so.4
> #11 0xb6ece339 in X509_free () from /lib/libcrypto.so.4
> #12 0xb6f5813c in SSL_SESSION_free () from /lib/libssl.so.4
> #13 0xb75d5141 in Kill_Single_Session (session=0xb6f2bdb0) at
> ssluse.c:587
> #14 0xb75d51a7 in Curl_SSL_Close_All (data=0x80b9408) at ssluse.c:613
> #15 0xb75ce35c in Curl_close (data=0x80b9408) at url.c:208
> #16 0xb75dcfcc in curl_easy_cleanup (curl=0x80b9408) at easy.c:398
> #17 0x0804d845 in CFXRequest::Perform() (this=0x80b8168) at
> CFXRequest.cpp:208
> #18 0x0804e54b in CCURLIntfc::Perform() (this=0xbfffaa28) at
> CCURLIntfc.cpp:119
> #19 0x0804b266 in CFXFwdServer::OnTimer() (this=0xbfffa870) at
> CFXFwdServer.cpp:188
> #20 0x080543dc in CEasyServer::Run() (this=0xbfffa870) at
> EasyServer.cpp:131
> #21 0x08054334 in CEasyServer::Start() (this=0xbfffa870) at
> EasyServer.cpp:98
> #22 0x0804a7cf in main (argc=1, argv=0xbfffaae4) at
> CFXFwdServer.cpp:42
> (gdb)
>
> I have a process which will be making a single request over and over
> (different data in the post). Should I be using a single CURL* object
> (ie call init() once and never call cleanup()) ?
>
> I have tried this and the memory leakage growth is HUGE...
>
> Thank you,
> David Tarendash

-- 
If quizzes are quizzical, what are tests?


WordWrap = False
LogFileName = mss.log

Received on 2004-09-24