cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Memory problem with Windows

From: Gonzalo Diethelm <gonzalo.diethelm_at_aditiva.com>
Date: Wed, 1 Dec 2004 16:24:40 -0300

> How about any DLL-related problems? I just noticed the
> recommendation to use
> sqlite_freemem() instead of free() for any errors returned by
> SQLite; this is (I guess) related to allocating memory in one
> DLL (SQLite) and erasing it in another one. Unluckily, that
> change did not fix my symptoms... Could this kind of
> DLL-memory thing surface anywhere else in SQLite?

Well, found the problem myself, and will report it here in case it might
help someone.

Basically, I had implemented my own atexit() function, which was running
from a given DLL. When this home-bred atexit() called the registered
functions, things crashed because those functions (whose purpose was to
clean up) had to be called FROM THE SAME DLL where they had been registered.
For instance, since libcurl was initialized from a DLL, it HAD to be cleaned
up from the SAME DLL.

The solution was simple: just call atexit() directly from each place, since
it seems to have the logic necessary to ensure the registered functions are
called in the right context.

Well, thanks for all the indirect help. Thinking about it got me to the
solution. Regards,

-- 
Gonzalo Diethelm
gonzalo.diethelm_at_aditiva.com
Received on 2004-12-01