This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 163439 - SQL Query Editor uses all of memory
Summary: SQL Query Editor uses all of memory
Status: VERIFIED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: SQL Editor (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker with 1 vote (vote)
Assignee: Jiri Rechtacek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-23 04:55 UTC by milestonebass
Modified: 2010-07-08 09:10 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description milestonebass 2009-04-23 04:55:45 UTC
When executing any query in the netbeans sql editor the memory usage jumps from around 90mb up to 400mb. If I execute
another query it will max out at it's maximum allocation of approx. 508mb and netbeans will freeze. This issue only
started appearing for me in version 6.1. It, however, was not an issue in the 6.1 beta. Every release from then on has
given me the same problem.

Encountered when trying these:

Netbeans 6.1 and higher
jdk update 11, 12 and then tried 5.
OS Ubuntu 8.10
Comment 1 Jiri Rechtacek 2009-09-03 15:07:30 UTC
please, provide more details about the issue. We need to know how to reproduce it.
Could you take thread dump when editor uses all memory? - http://wiki.netbeans.org/GenerateThreadDump
Also you can since NetBeans6.7 invoke the button "Profile Me" from IDE's toolbar. Thanks
Comment 2 Jiri Skrivanek 2009-09-15 14:53:53 UTC
Cannot reproduce.
Comment 3 milestonebass 2009-09-25 08:09:33 UTC
Moved on to new Ubuntu 9.04 and issue disappeared.
Comment 4 toddfast 2010-06-08 23:11:21 UTC
I just had this problem on NetBeans 6.8. The root cause is the SQL History feature.

Yesterday, I ran a very large SQL file (200,000 records) from the IDE and then today noticed that any sort of SQL statement would cause my heap to jump ~300MB. GC had no effect, indicating some kind of leak. Before running the large SQL file, running any other SQL statement from the IDE would cause my heap to jump maybe just 1-5MB.

I found that after running the large SQL file, the sql_history.xml file in <NB user dir>/config/Databases/SQLHISTORY grew to ~11MB. Apparently this file would be read into memory when any SQL statement was executed from the IDE, and the in-memory model caused the excessive memory usage.

The workaround is to simply delete sql_history.xml and restart the IDE. This file will not grow large unless you execute another large set of SQL statements. In that case, you will need to delete the history file again.

Unfortunately, this is not a permanent fix since the SQL history feature cannot be turned off. Even setting the number of statements to save to 0 doesn't prevent it from recording the history.

I recommend allowing the SQL history feature to be turned off, and limit the size of the history file. It would also be a good idea to look at the in-memory representation to understand why 11MB of XML on disk results in ~300MB of heap usage.
Comment 5 toddfast 2010-06-08 23:13:05 UTC
I forgot to note that I saw this problem on Windows 7. It does not appear to be platform-specific.
Comment 6 Jiri Rechtacek 2010-06-09 08:28:17 UTC
Limit of count of command makes sense, I'm going to review model for representation SQL command for possible memory leaks. Thanks for justification this issue.
Comment 7 Antonin Nebuzelsky 2010-06-09 12:21:50 UTC
Let's consider this issue for 6.9.1.
Comment 8 Antonin Nebuzelsky 2010-06-18 15:12:22 UTC
Jirko, what is the status of evaluation?!
Comment 9 Jiri Rechtacek 2010-06-18 15:59:48 UTC
Will be fixed soon to come in time for 691 patch.
Comment 10 rbalada 2010-06-22 07:49:38 UTC
Please report on progress, especially if you can make it into 6.9.1, if not please consider removing 6.9.1_CANDIDATE keyword.

Thanks,
-R
Comment 11 Jiri Rechtacek 2010-06-22 16:34:09 UTC
Fixed in core-main/rev/3354fafbc959
Comment 12 Quality Engineering 2010-06-23 03:29:28 UTC
Integrated into 'main-golden', will be available in build *201006230001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/3354fafbc959
User: Jiri Rechtacek <jrechtacek@netbeans.org>
Log: #163439: SQL Query Editor uses all of memory
Comment 13 Marian Mirilovic 2010-06-23 12:23:24 UTC
verified in 201006230001
Comment 14 rbalada 2010-06-23 14:35:28 UTC
main #3354fafbc959 transplanted to release691 #ef7c28da5652
Comment 15 Jaroslav Pospisil 2010-07-08 09:10:00 UTC
verified in 201007062301