• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Out of memory Error

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
catherine matthews
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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.
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic