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 142645 - [65cat] OutOfMemoryError: Java heap space
Summary: [65cat] OutOfMemoryError: Java heap space
Status: NEW
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: John Baker
Depends on:
Reported: 2008-08-01 20:47 UTC by sunbiz
Modified: 2014-07-31 07:13 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 85427

stacktrace (2.51 KB, text/plain)
2008-08-01 20:47 UTC, sunbiz

Note You need to log in before you can comment on or make changes to this bug.
Description sunbiz 2008-08-01 20:47:26 UTC
Build: NetBeans IDE Dev (Build 080731)
VM: Java HotSpot(TM) Client VM, 11.0-b12, Java(TM) SE Runtime Environment, 1.6.0_10-beta-b25
OS: Windows Vista, 6.0, x86

User Comments: 
Running a long query from the query designer causes this exception

java.lang.OutOfMemoryError: Java heap space
        at com.mysql.jdbc.MysqlIO.nextRow(
        at com.mysql.jdbc.MysqlIO.readSingleRowSet(
        at com.mysql.jdbc.MysqlIO.getResultSet(
        at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(
        at com.mysql.jdbc.MysqlIO.readAllResults(
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(
Comment 1 sunbiz 2008-08-01 20:47:34 UTC
Created attachment 66350 [details]
Comment 2 sunbiz 2008-08-01 20:57:19 UTC
One sure and easy way to reproduce this bug:
1.) Create the sakila demo MySQL database:
2.) Open query designer
3.) drop any tables say: actor, film, film_actor and language
4.) Also add address which is not a related table
5.) Run the generated query. This causes an OutOfMemoryException after trying for sometime to get data for the query.
Comment 3 David Vancouvering 2008-08-01 21:15:10 UTC
I ran into this elsewhere (in the SQL Editor I think).  The problem is that the MySQL JDBC driver by default fetches
*all* the rows from the database, and will happily run out of memory if the result set is large enough. 
Statement.setFetchSize() has no effect.

I think as of MySQL 5.0 Statement.setFetchSize() works to throttle the number of rows fetched at a time.

For more information see,137457,146876#msg-146876 and

John, you can also contact Mark Matthews directly if need be.

However, this doesn't solve things for the application code.  The application writer working with a query that returns a
lot of results will need to set fetch size in their code explicitly or risk running out of memory.
Comment 4 John Baker 2008-08-01 23:57:01 UTC
David if you have an SQL script that inserts lots of rows, could you email it to me or attach it if it's not too large.
Comment 5 David Vancouvering 2008-08-04 23:02:53 UTC
I don't think I have such a script any more.  What I did was write a JDBC program that inserts 100 rows in a batch and
then just run it N times until you get enough data.  We should probably put such a script on the Wiki once it's working,
as this seems to come up pretty regularly.

Comment 6 David Vancouvering 2008-08-15 20:35:38 UTC
John, can you please evaluate this issue.  Do you plan to fix it in 6.5?  The Sakila plugin should give you what you
need to reproduce.
Comment 7 David Vancouvering 2008-09-24 19:52:59 UTC
We were not able to get to these issues before code freeze - changing target
milestone to 'future'
Comment 8 Petr Blaha 2008-11-18 13:09:05 UTC
Move visualsqleditor subcomponents below visualweb