Results 1 to 15 of 15
  1. #1
    Eku
    Eku is offline Senior Member
    Join Date
    May 2008
    Location
    Makati, Philippines
    Posts
    234
    Rep Power
    7

    Exclamation Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

    Can anyone give me an idea on how to increase the heap size in Netbeans. Im trying to extract a single file that has 24MB data.

    My heap size is in default, how can i set it to a higher value in Netbeans6.1
    Mind only knows what lies near the heart, it alone sees the depth of the soul.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  3. #3
    Eku
    Eku is offline Senior Member
    Join Date
    May 2008
    Location
    Makati, Philippines
    Posts
    234
    Rep Power
    7

    Default

    yes i did. here is my config file.

    Java Code:
    # ${HOME} will be replaced by JVM user.home system property
    netbeans_default_userdir="${HOME}/.netbeans/6.1"
    
    # 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:PermSize=32m -J-XX:MaxPermSize=200m -J-Xverify:none -J-Dapple.laf.useScreenMenuBar=true -J-Dsun.java2d.noddraw=true"
    # Note that a default -Xmx is selected for you automatically.
    # You can find this value in var/log/messages.log file in your userdir.
    # The automatically selected value can be overridden by specifying -J-Xmx here
    # or on the command line.
    
    # 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.6.0_05"
    
    # Additional module clusters, using ${path.separator} (';' on Windows or ':' on Unix):
    #netbeans_extraclusters="/absolute/path/to/cluster1:/absolute/path/to/cluster2"
    
    # If you have some problems with detect of proxy settings, you may want to enable
    # detect the proxy settings provided by JDK5 or higher.
    # In such case add -J-Djava.net.useSystemProxies=true to the netbeans_default_options.
    The thing is i dont know the command to use in Netbeans 6.1. I use mr.Google of course it told me to use java -Xms(Min memory) -Xmx(max Memory) main
    but that is use for a command line compilation.
    Mind only knows what lies near the heart, it alone sees the depth of the soul.

  4. #4
    Eku
    Eku is offline Senior Member
    Join Date
    May 2008
    Location
    Makati, Philippines
    Posts
    234
    Rep Power
    7

    Default

    I even visited the site inside the config but it only tells to change the algorithm of the garbage collector not to increase the heap size. . .

    Can I use other data type to store a 24MB file? what is the best data type to use for a large File? im trying Sting array but i have that outofmemory error ^_^
    Mind only knows what lies near the heart, it alone sees the depth of the soul.

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    You have to increase -J-Xms32m and -J-XX:MaxPermSize=200m in same size. Save the file and restart NetBeans. It works fine for me.

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by Eku View Post
    I even visited the site inside the config but it only tells to change the algorithm of the garbage collector not to increase the heap size. . .

    Can I use other data type to store a 24MB file? what is the best data type to use for a large File? im trying Sting array but i have that outofmemory error ^_^
    Are you write data to a file? I'm not clear. If so why you worried about the size.

  7. #7
    Eku
    Eku is offline Senior Member
    Join Date
    May 2008
    Location
    Makati, Philippines
    Posts
    234
    Rep Power
    7

    Default

    i try using
    -J-Xms64m and -J-XX:MaxPermSize=300m

    but still it aint enuf...
    i also try
    -J-Xms128m and -J-XX:MaxPermSize=400m
    -My netbeans Wont Run Anymore maybe because my RAM is only 512mb. 400 + 128 = 528 T_T

    now i tried using
    -J-Xms64m and -J-XX:MaxPermSize=400m

    I got the same result. I guess this machine really needs an upgrade. =) What type of data type can store more than a String can?
    Mind only knows what lies near the heart, it alone sees the depth of the soul.

  8. #8
    Eku
    Eku is offline Senior Member
    Join Date
    May 2008
    Location
    Makati, Philippines
    Posts
    234
    Rep Power
    7

    Default

    Im trying to Open a File. collect the Data. Process the data and store them in their own specific database. =)
    Mind only knows what lies near the heart, it alone sees the depth of the soul.

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Yep, you need an upgrade. Your first attempt, you can't exceed the total memory on the system. Thats is 512.

    Even on the second attempt, what happened is the memory is not enough on the system for other process.

  10. #10
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    im trying Sting array but i have that outofmemory error ^_^
    How about breaking those data into chunks...(Another String arrays)
    I guess, the maximum String array length is the same as the MAXVALUE of an integer can handle or lesser...

    PS. NetBeans is also a Program made from Java... it can handle more than 24MB of data in a project...
    Last edited by sukatoa; 06-11-2008 at 09:19 AM.
    freedom exists in the world of ideas

  11. #11
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by Eku View Post
    Im trying to Open a File. collect the Data. Process the data and store them in their own specific database. =)
    That means, you've an issue with buffering the file, because of large size. Can't you split the original file.

  12. #12
    Eku
    Eku is offline Senior Member
    Join Date
    May 2008
    Location
    Makati, Philippines
    Posts
    234
    Rep Power
    7

    Default

    No i cant. that 24MB file is an output of a bigger system that has 81 columns and the data is in a straight single line. So i dont know where i can make a split. it consists of 176K data. ^_^ Actually this is not my problem, i just want to know what can i do if this kind of problem came to my Desk ^_^
    Mind only knows what lies near the heart, it alone sees the depth of the soul.

  13. #13
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Here is my comment,

    1. This is a bad practice. Even this is not an issue on your end, records data to such a large files is a bad practice. You can survive up to some level because of Java.

    2. Next solution is, increase the heap size. But you have limitations depend on your system.

  14. #14
    Eku
    Eku is offline Senior Member
    Join Date
    May 2008
    Location
    Makati, Philippines
    Posts
    234
    Rep Power
    7

    Default

    Thanks a Lot Erangga. I'll look for a better way to deal with Large files. =)
    Mind only knows what lies near the heart, it alone sees the depth of the soul.

  15. #15
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    np my friend.

    Did you use a BufferedReader to read that large file? If so, you system is freeze reading that large file? I never comes with such things. Even my server applications I never allowed to create a file more that 5MB of size. Basically log files.

Similar Threads

  1. Replies: 8
    Last Post: 03-05-2011, 04:53 AM
  2. Replies: 1
    Last Post: 08-07-2007, 08:10 AM
  3. Replies: 1
    Last Post: 08-06-2007, 07:07 AM
  4. Replies: 1
    Last Post: 07-25-2007, 11:55 PM
  5. Replies: 1
    Last Post: 07-16-2007, 07:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •