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?

  • 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? Sep 6 '12 at 14:56
  • You are probably right about the edit, but then it becomes an SO-question I'm sure. 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. Sep 6 '12 at 18:12

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.

  • 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. 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .