Bug #3451 Prepared statement execution reports memory leaks
Submitted: 12 Apr 2004 22:53 Modified: 5 May 2004 11:40
Reporter: Sergey Petrunya Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1-bk OS:
Assigned to: Sergey Petrunya CPU Architecture:Any

[12 Apr 2004 22:53] Sergey Petrunya
Prepared statement execution may cause memory leaks.
The leaks are visible when running tests/client_test against a server started with --debug. I haven't investigated if memory is leaked when --debug option is turned off.
The number of leaks reported is proportional to number of times one runs tests/client_test.
The effect shows up on several machines with different gcc versions.

How to repeat:
Run server with --debug and run tests/client_test againist it.
then shutdown the server and get the following:
Warning: Not freed memory segments: 23
Warning: Memory that was not free'ed (552 bytes):
            24 bytes at 0x0085b17d8, allocated at line   54 in 'sql_string.cc'
            24 bytes at 0x0085bcc78, allocated at line   54 in 'sql_string.cc'
            ...repeated total 23 times...
            24 bytes at 0x0085b19a8, allocated at line   54 in 'sql_string.cc'
Maximum memory usage: 9465331 bytes (9244k)

Suggested fix:
In particular client_test.c:test_select() causes server to make one leak in second  call of print_where() from optimize_cond().
[18 Apr 2004 16:39] Sergey Petrunya
See changeset: 
 psergey:1.1791 Fix for BUG#3451: Delete Items created during Prepared Statement execution
[5 May 2004 11:40] Michael Widenius
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at