Bug #28930 consistant memory leak when executing simple query
Submitted: 6 Jun 2007 18:45 Modified: 16 Feb 2009 11:00
Reporter: Jamie Maher Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Query Browser Severity:S2 (Serious)
Version:1.2.12 OS:Microsoft Windows (2000 Pro)
Assigned to: Mike Lischke CPU Architecture:Any
Tags: memory leak

[6 Jun 2007 18:45] Jamie Maher
Description:
The MySQL Query Browser seems to be suffering from severe memory leaks.. so much so that I have to restart the browser many times if I wish to keep using it.

Base memory usage 648 MB (after starting the QB but not excuting any queries). 

After 10 (ten!) seconds of running the query repeatedly (holding ctrl-enter down) memory usage is now 1083 MB and I get the following message:

"The memory load of the system is extremly (sp?) high. 
In order to keep the system responsive record set retrieval has been stopped"

Each query execution seems to increase the memory load by about 4-6 MB.

The browser is not releasing memory on my system when executing the same query multiple times.  Closing the Resultset Tab does not release the memory and I have to close and restart the Query Browser to have it release the memory.

How to repeat:
- Open Query Browser 
- Use the following example query: SELECT * FROM mysql.user;
- Click in the query area and hold down CTRL-ENTER
- Watch your memory usage fly straight up until you error from low memory.

Suggested fix:
Please identify where the memory leaks are and fix them..
[6 Jun 2007 19:49] Valeriy Kravchuk
Thank you for a problem report. I was NOT able to get huge memory leak on 32-bit Windows XP, but memory usage by QB certainly increased when running the same query many times, and closing resultset tab had not helped to decrease memory usage back. So, I think, the problem should be seriously considered and explained. 

Maybe, it has something to do with creating new connection/threrad for each and every query execution.
[6 Jun 2007 20:15] Jamie Maher
It might not be a memory leak per say, since when the program is closed the memory is reclaimed.  However, the constant memory creep makes the program unusuable for after an hour or two.  This is especially annoying since I often keep other resultset tabs open for reference. It is a pain to close the whole program and then re-launch it and re-open all of those queries again.

Thank you for your prompt attention in this matter..

Jamie
[9 Aug 2007 21:42] Starson Hochschild
This happens to me as well.

Refer to a near-duplicate bug, #30108, for more info and screen shots:
http://bugs.mysql.com/bug.php?id=30108
[7 Oct 2007 3:13] Robert Campbell
I have this problem also. Seems if I leave MySQL Query Browser running for 2 or 3 days it is using over 1Gig of Ram. About 1.4 and rising. When I exit MySQL the memory is restored. What I do now is Quit and Reload MySQL Query Browser. It is a real pain some times. Seems I do not have to run any queries and my system will run out of memory. 
    In other words I leave MySQL Query Browser running over the week end, idol, not running anything and When I return to work my system seems crippled because MySQL Query Browser has used up all available memory while I was gone.
[16 Feb 2009 11:00] Mike Lischke
This issues has been fixed already, even though there seems still to be a very small leak (like 20 KiB per query), though this also seems to depend on what is retrieved. I have seen other queries which do not leak any memory at all (also with 1000+ rows in the result set).

However the big problem is solved and that counts.
[16 Feb 2009 15:32] Starson Hochschild
The latest release, 1.2.16, still exibits the same behavior as 1.2.12, so unless your claim that the issue has been resolved refers to a development version I do not believe this has been fixed.

Even the most trivial select:
SELECT 1;
will result in a leak of almost 300KB for each execution.
By repeating this simple query by holding ctrl+enter I can get QB to go from 12MB to 266MB in just 35 seconds in either version.

If I had time I'd dig through the source and offer a solution like I did for http://bugs.mysql.com/bug.php?id=30108 (which still hasn't been resolved.)

Versions: 1.2.12, 1.1.16
OS: XP Pro SP3
[16 Feb 2009 15:33] Starson Hochschild
12MB @ 9:49:49

Attachment: MySqlLeak12mb.gif (image/gif, text), 40.29 KiB.

[16 Feb 2009 15:34] Starson Hochschild
266MB @ 9:50:24

Attachment: MySqlLeak266mb.gif (image/gif, text), 40.39 KiB.