my dog learned polymorphism*
The moose likes Beginning Java and the fly likes Out of memory Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Out of memory Error" Watch "Out of memory Error" New topic
Author

Out of memory Error

catherine matthews
Ranch Hand

Joined: Jan 22, 2006
Posts: 78
Hi there, i am using netbeans 6.0

when i am exporting the Jtable to my excel sheet i am encountering out of memory error in java heap space error. I tried setting the JVM heapsze manually but it was not working. Is there any method to explicitly allocate memory accoding to the size of the table? Or any other ways i could do to solve this problem? Thank You....


[ April 21, 2008: Message edited by: catherine matthews ]
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

You can only configure memory via JVM parameters. What didn't work when you tried it? A 32bit JVM on Windows should allow up to 1.5GB heap space - is your data much bigger than that?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
catherine matthews
Ranch Hand

Joined: Jan 22, 2006
Posts: 78
I have changed the JVM parameter in netbeans/etc/netbeans.conf
I changed MaxPermSize from 200 to 512
But i am still facing the problem. Am i changing it in the right way?

# ${HOME} will be replaced by JVM user.home system property
netbeans_default_userdir="${HOME}/.netbeans/6.0"

# Options used by NetBeans launcher by default, can be overridden by explicit
# command line switches:
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX ermSize=32m -J-XX:MaxPermSize=512m -J-Xverify:none -J-Dapple.laf.useScreenMenuBar=true"
# (Note that a default -Xmx is selected for you automatically.)

# If you specify the heap size (-Xmx) explicitely, you may also want to enable
# Concurrent Mark & Sweep garbage collector. In such case add the following
# options to the netbeans_default_options:
# -J-XX:+UseConcMarkSweepGC -J-XX:+CMSClassUnloadingEnabled -J-XX:+CMSPermGenSweepingEnabled
# (see http://wiki.netbeans.org/wiki/view/FaqGCPauses)

# Default location of JDK, can be overridden by using --jdkhome <dir>:
netbeans_jdkhome="C:\Program Files\Java\jdk1.5.0_15"

# Additional module clusters, using ${path.separator} (';' on Windows or ':' on Unix):
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Is it the permanent generation space you are having trouble with or the heap? 512m is a big value for the perm gen space, but the 32m you have defined for your heap is quite small, particularaly if you have a large data set you are exporting to excel.
catherine matthews
Ranch Hand

Joined: Jan 22, 2006
Posts: 78
I have added the following in my initialization....
But the problem is the same

netbeans_default_options="-J-Xms128m -J-Xmx384m -J-XX:NewRatio=20 -J-XX:+UseConcMarkSweepGC -J-XX:+UseParNewGC -J-XX:+CMSPermGenSweepingEnabled -J-XX:+CMSClassUnloadingEnabled -J-XX:+CMSPermGenPrecleaningEnabled -J-XX ermSize=64m -J-XX:MaxPermSize=96m -J-Dswing.aatext=true"

The Jtable have around 3000 records to be exported. The size of the table can go up to 512MB. What else can i do? Is there a way to do garbage collection to release memory?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


J-Xms128m -J-Xmx384m

Keep increasing these. Like I say, on 32bit Windows (which is the most limited OS) you can push the heap size up to c1.5GB if you need to.
Vlado Zajac
Ranch Hand

Joined: Aug 03, 2004
Posts: 245
1. POI (do you use this library for writing to Excel?) may need huge amount of memory.

2. Only -Xmx is important.

3. netbeans.conf may not affect your program at all. Are you sure that it configures your program and not only the Netbeans IDE?

In JBuilder each project has its own configuration of JVM options and parameters. The main config file only affect the IDE.
catherine matthews
Ranch Hand

Joined: Jan 22, 2006
Posts: 78
Yes, i am using a POI library. The conf file had no effect. I tried changing it to the maximum amount as possible. The problem was solved as I changed the VM Options in the Run Properties in Netbeans.

Thank you guys,

Anyway can anyone tell me why it did not work?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Out of memory Error