Bug #88448 | SQLExecDirect(hstmt, (SQLTCHAR*)"USE table;", SQL_NTS); leaks memorry upto 4Gb, | ||
---|---|---|---|
Submitted: | 12 Nov 2017 3:47 | Modified: | 22 Nov 2017 10:47 |
Reporter: | Nik Rayan | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / ODBC | Severity: | S3 (Non-critical) |
Version: | 5.20.70 | OS: | Windows (10) |
Assigned to: | CPU Architecture: | Any |
[12 Nov 2017 3:47]
Nik Rayan
[22 Nov 2017 9:46]
Bogdan Degtyariov
Hi Nik, Thank you for your interest in MySQL software. Your test program leaks memory because the statement is not freed. Accordingly to ODBC API specification this function call only closes the cursor associated with the statement: SQLFreeStmt(hstmt, SQL_CLOSE); You can check here the meaning of SQL_CLOSE for SQLFreeStmt: https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlfreestmt-function To free the previously allocated STMT handle the parameter SQL_CLOSE has to be replaced by SQL_DROP: SQLFreeStmt(hstmt, SQL_DROP); After doing this simple change to your code the memory leak has stopped. Therefore, I am closing this report with "Not a Bug" status. Please feel free to reopen it at any time if the leak is still happening or you have more information about the problem. Thanks.
[22 Nov 2017 10:47]
Nik Rayan
Thanks!