[Serdev] Question about memory stats
Andreas Granig
andreas.granig at inode.info
Thu Sep 1 14:55:17 UTC 2005
Jan Janak wrote:
> No, they are sorted according to the starting address. Maybe I could
> help you if you post the whole log.
I found the problem. It's because of nested mysql queries.
I created two different connections because I already suspected that
there could be a problem using the same connection.
But although I have two different connection pointers obtained by
dbf.init(db_url.s), they both share the same underlying connection (the
tail-pointer in db_con_t) which is rather wired IMHO. Now when the inner
query is freed, the res-pointer of the outer result is set to NULL by
the inner one, so when freeing the outer result, mysql_free_result() is
called with a NULL pointer, and that's why the leak doesn't show up in
the memory dump.
The attached little diff which disables the mysql pool solves the issue,
but I think the pool handling should really be reviewed...
Andy
-------------- next part --------------
Index: modules/mysql/my_pool.c
===================================================================
RCS file: /cvsroot/ser/sip_router/modules/mysql/Attic/my_pool.c,v
retrieving revision 1.1
diff -u -r1.1 my_pool.c
--- modules/mysql/my_pool.c 26 Jan 2004 12:46:15 -0000 1.1
+++ modules/mysql/my_pool.c 1 Sep 2005 14:51:22 -0000
@@ -69,6 +69,7 @@
id = new_my_id(url);
if (!id) return 0;
+#if 0
ptr = pool;
while (ptr) {
if (cmp_my_id(id, ptr->id)) {
@@ -79,6 +80,7 @@
}
ptr = ptr->next;
}
+#endif
DBG("get_connection(): Connection not found in the pool\n");
ptr = new_connection(id);
More information about the Serdev
mailing list