Bug #70204 memory leak when crecordset.update used.
Submitted: 30 Aug 2013 17:10 Modified: 3 Sep 2013 8:23
Reporter: Bogdan Pytlik Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:5.2.5 Ansi OS:Windows (Windows 2003 R2 SP2 32-bit)
Assigned to: Bogdan Degtyariov CPU Architecture:Any
Tags: MyODBC

[30 Aug 2013 17:10] Bogdan Pytlik
Description:
When using CDatabase/CRecordset, the crecordset.update causes memory leak.

  Windows 2003 R2 SP2 32-bit

  Server version: 5.6.13-log MySQL Community Server (GPL)

  ODBC connector 5.2.5 Ansi

How to repeat:
  Windows 2003 R2 SP2 32-bit

  Server version: 5.6.13-log MySQL Community Server (GPL)

  ODBC connector 5.2.5 Ansi
  
    [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\test]
    "Driver"="C:\\mysql\\Connector ODBC 5.2.5\\myodbc5a.dll"
    "SERVER"="127.0.0.1"
    "UID"="root"
    "PWD"="1234root"
    "DATABASE"="test"
    "PORT"="3306"
    "FOUND_ROWS"="1"
    "BIG_PACKETS"="1"
    "NO_PROMPT"="1"
    "NO_TRANSACTIONS"="1"
    "NO_CACHE"="1"

  create-table.sql   sql to create/populate sample table
  mysql.exe test < create-table.sql

  - create table in 'test' (DSN=test hardcoded in the program) database using create-table.sql
    mysql -uroot -proot test < create-table.sql

  - building test application 
    *.vcxproj  Visual Studio 2010 project to build test exe.

    "C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"
    msbuild.exe /nologo /p:Configuration=Release /p:Platform=Win32 /fl /clp:DisableConsoleColor mysql_odbc_2.vcxproj

  - Running test exe (numeric argument is number of iterations)
      Release\mysql_odbc_2.exe 

  - start C:\WINDOWS\system32\perfmon.exe and add counter for private bytes o mysql_odbc_2.exe, 
     refresh every 10 secons watch the Private Bytes steadily increase

  - when Update is disabled, then there is no leak
      Release\mysql_odbc_2.exe -no-update

  - the perfmon-mem-leak.jpg shows memory usage with update (steep line) and without update (flat line)
[30 Aug 2013 17:14] Bogdan Pytlik
source and data

Attachment: mysql-odbc-mem-leak.zip (application/x-zip-compressed, text), 39.26 KiB.

[30 Aug 2013 17:31] Bogdan Pytlik
sample app

Attachment: mysql_odbc_2.cpp (text/plain), 2.67 KiB.

[30 Aug 2013 17:31] Bogdan Pytlik
perfmon memory log

Attachment: perfmon-mem-leak.jpg (image/jpeg, text), 45.72 KiB.

[3 Sep 2013 8:23] Bogdan Degtyariov
Hi Bogdan,

Thank you for your interest in MySQL software.
The problem with the memory leak has already been reported.
So, I am marking this bug as a duplicate of bug 70113.