This page is no longer maintained — Please continue to the home page at www.scala-lang.org

[netbeans] out of memory error, heap space

12 replies
Sciss
Joined: 2008-12-17,
User offline. Last seen 28 weeks 5 days ago.

hi,

where in netbeans can i increase the heap space used for scalac? i already have -J-Xmx1024m in my netbeans.conf, but it doesn't seem to have any effect. when i press build or clean-build, i always end of with something like

init:
deps-jar:
Compiling 53 source files to /Users/rutz/Documents/devel/ScalaCollider/build/classes
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:3923)
at scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:13)
at scala.tools.nsc.symtab.Types$Type.$less$colon$less(Types.scala:604)
at scala.tools.nsc.backend.icode.TypeKinds$REFERENCE.$less$colon$less(TypeKinds.scala:285)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.adapt(GenICode.scala:933)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:927)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:551)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genLoadIf(GenICode.scala:363)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:511)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:850)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genLoadIf(GenICode.scala:363)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:511)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:850)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:850)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.default$2(GenICode.scala:1254)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genCond(GenICode.scala:1297)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genZandOrZor$1(GenICode.scala:1273)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genCond(GenICode.scala:1284)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genPrimitiveOp(GenICode.scala:427)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:714)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:130)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:87)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:87)
at scala.collection.LinearSeqLike$class.foreach(LinearSeqLike.scala:97)
at scala.collection.immutable.List.foreach(List.scala:46)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:87)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:152)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:106)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:87)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:87)
at scala.collection.LinearSeqLike$class.foreach(LinearSeqLike.scala:97)
at scala.collection.immutable.List.foreach(List.scala:46)
/Users/rutz/Documents/devel/ScalaCollider/nbproject/build-impl.xml:422: The following error occurred while executing this line:
/Users/rutz/Documents/devel/ScalaCollider/nbproject/build-impl.xml:255: Compilation failed because of an internal compiler error; see the error output for details.
BUILD FAILED (total time: 1 minute 48 seconds)

should i edit build-impl.xml? how?

thanks, -sciss-

anli
Joined: 2008-08-19,
User offline. Last seen 1 day 1 hour ago.
Re: [netbeans] out of memory error, heap space

On Saturday 02 January 2010 20:49:32 Sciss wrote:
> hi,
>
> where in netbeans can i increase the heap space used for scalac?

Have you tried to set ANT_OPTS enviroment variable? I have:

~$ echo $ANT_OPTS
-Xms2048M -Xmx2048M -Xss2M -XX:MaxPermSize=512M

But you can use smaller values if you don't build Scala from trunk (scaladoc 2
is *very* RAM hungry).

Sciss
Joined: 2008-12-17,
User offline. Last seen 28 weeks 5 days ago.
Re: [netbeans] out of memory error, heap space

the thing is i'm on os x. there is a doc that says how to set SCALA_HOME for os x (http://wiki.netbeans.org/MacOSXEnvForApp), but that is system wide, and i would prefer not to set a system wide environment variable for JAVA_OPTS or ANT_OPTS ...

Am 02.01.2010 um 18:15 schrieb Andrew Gaydenko:

> On Saturday 02 January 2010 20:49:32 Sciss wrote:
>> hi,
>>
>> where in netbeans can i increase the heap space used for scalac?
>
> Have you tried to set ANT_OPTS enviroment variable? I have:
>
> ~$ echo $ANT_OPTS
> -Xms2048M -Xmx2048M -Xss2M -XX:MaxPermSize=512M
>
> But you can use smaller values if you don't build Scala from trunk (scaladoc 2
> is *very* RAM hungry).
>
>

Sciss
Joined: 2008-12-17,
User offline. Last seen 28 weeks 5 days ago.
Re: [netbeans] out of memory error, heap space

also....

since i couldn't further here, i reimported my stuff into eclipse. clean-compile is fine in just 35 seconds. so i'm sure there's something wrong with the compiler in the netbeans plug-in.... ?

Am 02.01.2010 um 18:24 schrieb Sciss:

> the thing is i'm on os x. there is a doc that says how to set SCALA_HOME for os x (http://wiki.netbeans.org/MacOSXEnvForApp), but that is system wide, and i would prefer not to set a system wide environment variable for JAVA_OPTS or ANT_OPTS ...
>
> Am 02.01.2010 um 18:15 schrieb Andrew Gaydenko:
>
>> On Saturday 02 January 2010 20:49:32 Sciss wrote:
>>> hi,
>>>
>>> where in netbeans can i increase the heap space used for scalac?
>>
>> Have you tried to set ANT_OPTS enviroment variable? I have:
>>
>> ~$ echo $ANT_OPTS
>> -Xms2048M -Xmx2048M -Xss2M -XX:MaxPermSize=512M
>>
>> But you can use smaller values if you don't build Scala from trunk (scaladoc 2
>> is *very* RAM hungry).
>>
>>
>

anli
Joined: 2008-08-19,
User offline. Last seen 1 day 1 hour ago.
Re: [netbeans] out of memory error, heap space

On Saturday 02 January 2010 22:47:54 you wrote:
> also....
>
> since i couldn't further here, i reimported my stuff into eclipse.
> clean-compile is fine in just 35 seconds. so i'm sure there's something
> wrong with the compiler in the netbeans plug-in.... ?

The plugin uses bundled scala to run itself. For projects $SCALA_HOME and
$PATH are used.

Sciss
Joined: 2008-12-17,
User offline. Last seen 28 weeks 5 days ago.
Re: [netbeans] out of memory error, heap space

ok, but how does it invoke scalac when i press the build button? it doesn't seem to execute $SCALA_HOME/bin/scalac, because if i add some test "echo"s in there, they don't show up....

so the question remains: how do i increase the build compiler's max heap memory?

thanks, -sciss-

Am 02.01.2010 um 20:18 schrieb Andrew Gaydenko:

> On Saturday 02 January 2010 22:47:54 you wrote:
>> also....
>>
>> since i couldn't further here, i reimported my stuff into eclipse.
>> clean-compile is fine in just 35 seconds. so i'm sure there's something
>> wrong with the compiler in the netbeans plug-in.... ?
>
> The plugin uses bundled scala to run itself. For projects $SCALA_HOME and
> $PATH are used.
>

anli
Joined: 2008-08-19,
User offline. Last seen 1 day 1 hour ago.
Re: [netbeans] out of memory error, heap space

On Sunday 03 January 2010 00:29:09 Sciss wrote:
> ok, but how does it invoke scalac when i press the build button? it doesn't
> seem to execute $SCALA_HOME/bin/scalac, because if i add some test "echo"s
> in there, they don't show up....
>
> so the question remains: how do i increase the build compiler's max heap
> memory?

NB uses ant script. Try to build a project from command line using project's
build.xml file.

I can not imagine it is impossible to set ANT_OPTS inside NB-starting script
only (not system-wide).

ichoran
Joined: 2009-08-14,
User offline. Last seen 2 years 3 weeks ago.
Re: [netbeans] out of memory error, heap space
On Sat, Jan 2, 2010 at 4:29 PM, Sciss <contact@sciss.de> wrote:
ok, but how does it invoke scalac when i press the build button? it doesn't seem to execute $SCALA_HOME/bin/scalac, because if i add some test "echo"s in there, they don't show up....

It invokes its own scalac and/or fsc.  These should be in your netbeans module directory.  On Linux with Netbeans 6.5 and the 2.7 module, it's ~/.netbeans/6.5/modules/scala, for example.

  --Rex
 
anli
Joined: 2008-08-19,
User offline. Last seen 1 day 1 hour ago.
Re: [netbeans] out of memory error, heap space

On Sunday 03 January 2010 00:50:28 Rex Kerr wrote:
> It invokes its own scalac and/or fsc. These should be in your netbeans
> module directory. On Linux with Netbeans 6.5 and the 2.7 module, it's
> ~/.netbeans/6.5/modules/scala, for example.
>
> --Rex

It isn't so fo NB 6.8 - it uses SCALA_HOME and PATH vars.

Sciss
Joined: 2008-12-17,
User offline. Last seen 28 weeks 5 days ago.
Re: [netbeans] out of memory error, heap space

hmmm, running ant from the terminal gives the same error (despite ANT_OPT settings).

now running scalac directly from the terminal compiles all classes fine (with standard heap size!).... don't know what's going on there with netbeans build script, but i will just stick to this terminal compilation for the moment.

ciao, -sciss-

Am 02.01.2010 um 21:49 schrieb Andrew Gaydenko:

> On Sunday 03 January 2010 00:29:09 Sciss wrote:
>> ok, but how does it invoke scalac when i press the build button? it doesn't
>> seem to execute $SCALA_HOME/bin/scalac, because if i add some test "echo"s
>> in there, they don't show up....
>>
>> so the question remains: how do i increase the build compiler's max heap
>> memory?
>
> NB uses ant script. Try to build a project from command line using project's
> build.xml file.
>
> I can not imagine it is impossible to set ANT_OPTS inside NB-starting script
> only (not system-wide).

anli
Joined: 2008-08-19,
User offline. Last seen 1 day 1 hour ago.
Re: [netbeans] out of memory error, heap space

On Sunday 03 January 2010 01:37:36 you wrote:
> hmmm, running ant from the terminal gives the same error (despite ANT_OPT
> settings).

Do you have typo here only or in your scripts also? - I mean "OPT" where
"OPTS" must be used.

Sciss
Joined: 2008-12-17,
User offline. Last seen 28 weeks 5 days ago.
Re: [netbeans] out of memory error, heap space

i used this

export ANT_OPTS="-Xmx1024m"

...

Am 02.01.2010 um 22:56 schrieb Andrew Gaydenko:

> On Sunday 03 January 2010 01:37:36 you wrote:
>> hmmm, running ant from the terminal gives the same error (despite ANT_OPT
>> settings).
>
> Do you have typo here only or in your scripts also? - I mean "OPT" where
> "OPTS" must be used.

Sciss
Joined: 2008-12-17,
User offline. Last seen 28 weeks 5 days ago.
Re: [netbeans] out of memory error, heap space

i have now set $ANT_OPTS globally (in ~/.MacOSX/environment.plot):

i still get the out-of-mem hangup:

Compiling 57 source files to /Users/rutz/Documents/devel/ScalaCollider/build/classes
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at scala.tools.nsc.backend.icode.Members$Code.touched_$eq(Members.scala:43)
at scala.tools.nsc.backend.icode.Members$Code.newBlock(Members.scala:82)
at scala.tools.nsc.backend.icode.Members$Code.(Members.scala:49)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase$Context.enterMethod(GenICode.scala:1775)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:125)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:87)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:87)
at scala.collection.LinearSeqLike$class.foreach(LinearSeqLike.scala:97)
at scala.collection.immutable.List.foreach(List.scala:46)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:87)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:152)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:106)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:87)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:87)
at scala.collection.LinearSeqLike$class.foreach(LinearSeqLike.scala:97)
at scala.collection.immutable.List.foreach(List.scala:46)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:87)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:97)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:83)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.apply(GenICode.scala:79)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply(Global.scala:278)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply(Global.scala:278)
at scala.tools.nsc.reporters.Reporter.withSource(Reporter.scala:48)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:278)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:256)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:256)
at scala.collection.Iterator$class.foreach(Iterator.scala:582)
at scala.collection.mutable.ListBuffer$$anon$1.foreach(ListBuffer.scala:285)
at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:256)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.run(GenICode.scala:72)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:752)
at scala.tools.nsc.Global$Run.compile(Global.scala:842)
/Users/rutz/Documents/devel/ScalaCollider/nbproject/build-impl.xml:422: The following error occurred while executing this line:
/Users/rutz/Documents/devel/ScalaCollider/nbproject/build-impl.xml:255: Compilation failed because of an internal compiler error; see the error output for details.
BUILD FAILED (total time: 1 minute 15 seconds)

i have at least my hope that a new netbeans plugin build will not exhibit this problem. i wasn't able to install the plug-in from sources. is there any chance getting a new binary?

i can compile from the shell but i need the step debugger ATM...

thanks a lot, -sciss-

Am 02.01.2010 um 18:15 schrieb Andrew Gaydenko:

> On Saturday 02 January 2010 20:49:32 Sciss wrote:
>> hi,
>>
>> where in netbeans can i increase the heap space used for scalac?
>
> Have you tried to set ANT_OPTS enviroment variable? I have:
>
> ~$ echo $ANT_OPTS
> -Xms2048M -Xmx2048M -Xss2M -XX:MaxPermSize=512M
>
> But you can use smaller values if you don't build Scala from trunk (scaladoc 2
> is *very* RAM hungry).
>
>

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland