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

scalac stackoverflow - max number of terms ?

3 replies
meiko
Joined: 2008-09-27,
User offline. Last seen 3 years 10 weeks ago.

hi

what is the maximum number of terms for an expression ?

I am using scala 2.7.2.final
i got a stack overflow when adding 79 Ints: (78 is okay ;-)

object Stress {
1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
}

Merry Christmas

meiko

Ricky Clarkson
Joined: 2008-12-19,
User offline. Last seen 3 years 2 weeks ago.
Re: scalac stackoverflow - max number of terms ?
You can probably 'fix' this by increasing the amount of stack space you give scalac.

In general, I think scalac should either use the trampolining technique discussed a month ago (stolen from Clojure) for many such cases, or default to a larger stack.

2008/12/22 meiko rachimow <meiko@tfh-berlin.de>
hi

what is the maximum number of terms for an expression ?

I am using scala 2.7.2.final
i got a stack overflow when adding 79 Ints: (78 is okay ;-)

object Stress {
1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
}

Merry Christmas

meiko

meiko
Joined: 2008-09-27,
User offline. Last seen 3 years 10 weeks ago.
Re: scalac stackoverflow - max number of terms ?

Ah, yes - of course...
How to do it in the eclipse plugin ?

Ricky Clarkson schrieb:
> You can probably 'fix' this by increasing the amount of stack space
> you give scalac.
>
> In general, I think scalac should either use the trampolining
> technique discussed a month ago (stolen from Clojure) for many such
> cases, or default to a larger stack.
>
> 2008/12/22 meiko rachimow >
>
> hi
>
> what is the maximum number of terms for an expression ?
>
> I am using scala 2.7.2.final
> i got a stack overflow when adding 79 Ints: (78 is okay ;-)
>
> object Stress {
> 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
> }
>
> Merry Christmas
>
> meiko
>
>

Carsten Saager
Joined: 2008-12-19,
User offline. Last seen 42 years 45 weeks ago.
Re: scalac stackoverflow - max number of terms ?
eclipse.exe -vmargs -Xss2M

gives you 2M stack per thread. You might need to increase the heap memory as well (using -Xmx)

You have to run Eclipse under Java 6 under Windows as the 1.5 has a bug that renders the -Xss usesless

Trampolining the compiler might be the right idea. I got a stack overflow that correlates to the size of a mixed project. It is very annoying to have your whole project's development break down because you add a class to your project - especially when the standard parameters for Eclipse work fine for the whole project until your rewrite four classes in Scala.

/Carsten


On Mon, Dec 22, 2008 at 11:38 AM, meiko rachimow <meiko@tfh-berlin.de> wrote:
Ah, yes - of course...
How to do it in the eclipse plugin ?

Ricky Clarkson schrieb:
You can probably 'fix' this by increasing the amount of stack space you give scalac.

In general, I think scalac should either use the trampolining technique discussed a month ago (stolen from Clojure) for many such cases, or default to a larger stack.

2008/12/22 meiko rachimow <meiko@tfh-berlin.de <mailto:meiko@tfh-berlin.de>>

   hi

   what is the maximum number of terms for an expression ?

   I am using scala 2.7.2.final
   i got a stack overflow when adding 79 Ints: (78 is okay ;-)

   object Stress {
   1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
   }

   Merry Christmas

   meiko




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