|
From: Guilhem B. <gu...@my...> - 2004-10-20 20:47:33
|
Hi,
Well I had contacted Jonathan when I saw his post on
valgrind-users. Your analysis is right. There are three things:
1) a function to do this cleanup when the libmysqlclient library is not
needed anymore by the program, exists, it's mysql_server_end().
2) but it's not documented in the right place in the manual, and I am
in the process of fixing this, but delayed by 3)
3) mysql_server_end() is a bad name for a function which just frees
memory in the client; this function does nothing in the server. So we
are right now (well, since 3 days - I mean, we didn't do only this
over the last 3 days) discussing adding a more meaningful synonym like
mysql_library_end() maybe. Historically it was called
mysql_server_end() because it also frees memory if using libmysqld
(the embedded version of MySQL, the MySQL server in a library).
Calling mysql_server_end() fixed Jonathan's error.
Regards,
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Guilhem Bichot <gu...@my...>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Software Developer
/_/ /_/\_, /___/\___\_\___/ Bordeaux, France
<___/ www.mysql.com
|
|
From: Jonathan A. Z. <jon...@nu...> - 2004-10-20 21:01:00
|
just curious why you don't do this all atexit(). is there any time where someone would want to call mysql_server_init/end twice in a process? Guilhem Bichot wrote: > Hi, > > Well I had contacted Jonathan when I saw his post on > valgrind-users. Your analysis is right. There are three things: > 1) a function to do this cleanup when the libmysqlclient library is not > needed anymore by the program, exists, it's mysql_server_end(). > 2) but it's not documented in the right place in the manual, and I am > in the process of fixing this, but delayed by 3) > 3) mysql_server_end() is a bad name for a function which just frees > memory in the client; this function does nothing in the server. So we > are right now (well, since 3 days - I mean, we didn't do only this > over the last 3 days) discussing adding a more meaningful synonym like > mysql_library_end() maybe. Historically it was called > mysql_server_end() because it also frees memory if using libmysqld > (the embedded version of MySQL, the MySQL server in a library). > > Calling mysql_server_end() fixed Jonathan's error. > > Regards, |
|
From: Dimitri Papadopoulos-O. <pap...@sh...> - 2004-10-21 11:03:49
|
Hi, > just curious why you don't do this all atexit(). is there any time where > someone would want to call mysql_server_init/end twice in a process? It's a bad idea to use atexit() in a library. A shared library may be dlopened and then dlclosed and then re-dlopened later. One may need to clean up when the library is dlclosed, not when the program exits. For shared libraries, this could be automated using non-portable tricks such as _init and _fini on GNU platforms, or static objects in C++ programs (the latter trick actually doesn't work on many platforms). Dimitri |