Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
2.1
-
None
-
None
Description
When a mysql connection is created and is set to not blocking, mysql_close() doesn't free the memory associate with async causing a severe memory leak.
Depending from the the speed of your CPU and your available memory, the follow code can eat all available memory in just few seconds:
#include <mysql.h>
|
#include <stdio.h>
|
int main() {
|
while(1) {
|
MYSQL *mysql=mysql_init(NULL);
|
mysql_options(mysql, MYSQL_OPT_NONBLOCK, 0); // this line triggers the bug
|
mysql_close(mysql);
|
}
|
return 0;
|
}
|