Bug #16017 | Memory leak in mysql embedded library | ||
---|---|---|---|
Submitted: | 27 Dec 2005 13:50 | Modified: | 2 Aug 2006 17:52 |
Reporter: | Noam Ambar | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Embedded Library ( libmysqld ) | Severity: | S3 (Non-critical) |
Version: | 4.1.13, 5.1 | OS: | Linux (Linux (SuSE 9 kernel 2.6)) |
Assigned to: | Alexey Botchkov | CPU Architecture: | Any |
[27 Dec 2005 13:50]
Noam Ambar
[2 Jan 2006 13:46]
Hartmut Holzgraefe
I wasn't able to test with latest 5.0 source, but with 4.1 i see the process growing over time (a megabyte every few seconds) when using the following source: #include <stdlib.h> #include <stdio.h> #include <mysql.h> static char *server_groups[] = { "embedded", "server", (char *)NULL }; int main(int argc, char **argv) { MYSQL *mysql = NULL; int i; char query[256]; if (mysql_server_init(argc, argv, server_groups)) { fputs("server init failed", stderr); return EXIT_FAILURE; } mysql_thread_init(); MYSQL* handle = mysql_init(NULL); mysql_options(handle, MYSQL_READ_DEFAULT_GROUP, "libmysqld_client"); mysql_options(handle, MYSQL_OPT_USE_EMBEDDED_CONNECTION, NULL); mysql_real_connect(handle, NULL, NULL, NULL, "test", 0, NULL, 0); for(i=0; 1; i++) { printf("iteration %d\n", i); MYSQL_STMT* stmt = mysql_stmt_init(handle); char* command = "SELECT 1 FROM i1"; //char* command = "UPDATE T1 SET i1 = 1"; mysql_stmt_prepare(stmt, command, strlen(command)); mysql_stmt_execute(stmt); mysql_stmt_store_result(stmt); while (!mysql_stmt_fetch(stmt)) {} mysql_stmt_free_result(stmt); mysql_stmt_close(stmt); } mysql_close(handle); }
[2 Jan 2006 14:01]
Noam Ambar
Thank you for verifying it.
[5 Jan 2006 8:19]
Noam Ambar
Changing category to libmysqld
[2 Feb 2006 9:47]
Noam Ambar
After making some more tests I found out that this problem is related to the structure of the database. This problem exists in mysql5 when using database that was originally created with mysql4. If the database was originally created with mysql5, the memory leak does not show up
[1 Jun 2006 11:49]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/7155
[14 Jul 2006 16:15]
Paul DuBois
Noted in 4.1.21 changelog. Some memory leaks in the libmysqld embedded server were corrected. Returning report to NDI status pending push of fix into 5.1.
[2 Aug 2006 17:52]
Paul DuBois
Noted in 5.1.12 changelog.