Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm trying to run a well-coded algorithm that tries to solve an NP-Hard problem via NetBeans but I'm running out of heap space.

Is the heap space I'm running out of specific to Netbeans? If so: how do I increase the heap space available to Netbeans?

Or is it specific to the app, as launched from Netbeans? If so: how do I tell Netbeans to launch it with more heap space?

share|improve this question
    
Heap size is set via an argument to the JVM when you start an application. It's not a system-wide setting. You have to figure out how your specific app is being started and edit the heap size setting there. Might want to consider editing the question to focus on making this change for Netbeans specifically. –  Ian C. Sep 6 '12 at 14:52
    
But how can that be? It must have some standard setting, or is an implicit argument passed along when I start an app? –  The Unfun Cat Sep 6 '12 at 14:56
    
You are probably right about the edit, but then it becomes an SO-question I'm sure. –  The Unfun Cat Sep 6 '12 at 14:57
    
This is definitely an SO question IMO. Not an AD question. The actual answer is specific to Netbeans and very much OS independent. –  Ian C. Sep 6 '12 at 16:52
    
Yeah, it became Netbeans-specific. Thanks for the edit, Ian. To whomever it may concern: please move to SO. –  The Unfun Cat Sep 6 '12 at 18:12

1 Answer 1

up vote 2 down vote accepted

As Ian C. says, the heap size is Application specific, therefore, here's how you increase it for Netbeans:

  1. Right click on the NetBeans.app and select Show content of package.
  2. Inside the package go to /Contents/Resources/NetBeans/etc/ and open the netbeans.conf file.
  3. In the netbeans_default_options setting, change or add the following options: -J-Xmx... (e.g. -J-Xmx1600M) or -J-XX:MaxPermSize=... (e.g. -J-XX:MaxPermSize=500M).
  4. Save the file and restart the IDE.

If you want to increase the Project's heap size you must go to your project's Properties / Run / VM Options, and in the text box add the arguments.

share|improve this answer
    
Just to make sure I didn't phrase it badly: will this increase the heap space for the apps Netbeans open or just Netbeans itself? The memory-problem is with (a well-coded) algorithm that tries to solve an NP-Hard problem. –  The Unfun Cat Sep 6 '12 at 15:03
    
@TheUnfunCat You are right. This will only increase NetBean's heap space. I'll edit my answer with new data. –  Thecafremo Sep 6 '12 at 15:13
    
Thanks- added -Xmx2048. –  The Unfun Cat Sep 6 '12 at 16:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.