Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
3.0.0
-
None
-
None
Description
I try to use lgpl version of mysql c connector. When I link test program using:
mariadb_config --libs and mariadb_config --cflags, then I got memory leak.
When I link the same program using mysql_config --libs and mysql_config --cflags,
then there is no memory leak.
Is it a library bug or there is a bug in my test program?
My test function:
for(;;) { |
MYSQL mysql;
|
int arg; |
mysql_init(&mysql);
|
mysql_options(&mysql, MYSQL_READ_DEFAULT_GROUP, "client"); |
mysql_options(&mysql, MYSQL_OPT_COMPRESS, 0);
|
mysql_options(&mysql, MYSQL_OPT_NAMED_PIPE, 0);
|
arg = MYSQL_PROTOCOL_SOCKET;
|
mysql_options(&mysql, MYSQL_OPT_PROTOCOL, &arg);
|
if(!mysql_real_connect(&mysql, "localhost", DBUSER, DBPASS, DBNAME, |
0, 0, 0)) {
|
fprintf(stderr, "Failed to connect to database: Error: %s\n", mysql_error(&mysql)); |
return 1; |
}
|
mysql_close(&mysql);
|
}
|
return 0; |
I monitor memory usage with:
while true; do ps -o rss $PID; sleep 1; done
|
Without mysql_real_connect() there is no memory leak.