|
From: Igmar P. <mai...@jd...> - 2005-08-26 06:38:13
|
> Interestingly, the man-page doesn't tell me anything about > gethostbyname_r() to be free()d afterwards. So, I don't > understand in why it leaks there. Probably the char *buf argument : It's a user supplied buffer, en depending on how you allocate it, it's subject to a free() when it's malloc()'ed. I've can't remember what *ret and **result was all about, perhaps someone can shed a light on this. > However, this does not lead me into blindly assuming, > that it's glibc's fault here. But what could be wrong there? Writing a small testcase usually show how to deal with gethostbyname_r(). > And this is another odd one: > > ==16981== 4088 bytes in 1 blocks are still reachable in loss record 22 of 28 > ==16981== at 0x1B9008C1: malloc (vg_replace_malloc.c:149) > ==16981== by 0x1CCF63BD: my_once_alloc (in /usr/lib/libmysqlclient_r.so.14.0.0) > ==16981== by 0x1CCF6466: my_once_strdup (in /usr/lib/libmysqlclient_r.so.14.0.0) > ==16981== by 0x1CCF7021: (within /usr/lib/libmysqlclient_r.so.14.0.0) > ==16981== by 0x1CCFFF78: (within /usr/lib/libmysqlclient_r.so.14.0.0) > ==16981== by 0x1CD1026D: my_xml_parse (in /usr/lib/libmysqlclient_r.so.14.0.0) > ==16981== by 0x1CD004DA: my_parse_charset_xml (in /usr/lib/libmysqlclient_r.so.14.0.0) > ==16981== by 0x1CCF6A10: (within /usr/lib/libmysqlclient_r.so.14.0.0) > ==16981== by 0x1CCF6C8F: (within /usr/lib/libmysqlclient_r.so.14.0.0) > ==16981== by 0x1CCF76B8: get_charset_by_csname (in /usr/lib/libmysqlclient_r.so.14.0.0) > ==16981== by 0x1CD1504B: mysql_real_connect (in /usr/lib/libmysqlclient_r.so.14.0.0) > ==16981== by 0x1CB4313A: MySQL::connect(System::TStringBase<char> const&, System::TStringBase<char> const&, System::TStringBase<char> const&, System::TS > ==16981== by 0x1BA704DE: yacs::TServer::createConnection() const (TServer.cpp:590) > ==16981== by 0x1BA70575: yacs::TServer::initializeTables() (TServer.cpp:600) > ==16981== by 0x1BA6683E: yacs::TServer::TServer(int, System::TStringBase<char> const&, System::TStringBase<char> const&, System::TStringBase<char> const > ==16981== by 0x806380C: spawnServer() (yacsd.cpp:281) > ==16981== by 0x80659FA: main (yacsd.cpp:388) > > I'm pretty sure, that mysql_close() gets invoked everywhere, but somehow, > libmysqlclient leaks here a memory block regarding its connection establishment. > Well, I'm linking against the _r version of libmysqlclient, becuase it is supposed > to be fully multi threaded (some day) and I wanted to be on the safe side, > but I don't think that this is *causing* the leak. Looks like a mysql problem to me. Regards, Igmar |