Re: [Haskell-cafe] Stack overflow in ghci

2007-10-17 Thread Brent Yorgey
On 10/17/07, Maurí­cio <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I get this error message when testing a function
> in ghci:
>
>   *** Exception: stack overflow
>
> I admit I didn't care about efficiency when I
> wrote that function, but I'm almost sure it is not
> supposed to eat all my memory. Do I need to say
> something to ghci if I want it to use all
> available memory?
>
> Thanks,
> Maurício


This can also be caused by some code which is more lazy than necessary, if a
huge thunk (= unevaluated expression) is generated which blows the stack
when it is evaluated.  You may want to read this page:

http://haskell.org/haskellwiki/Stack_overflow

You should also feel free to send the code causing trouble to this list, and
someone can help you figure out what is going on.

-Brent
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Stack overflow in ghci

2007-10-17 Thread Tim Chevalier
On 10/17/07, Maurí­cio <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I get this error message when testing a function
> in ghci:
>
>   *** Exception: stack overflow
>
> I admit I didn't care about efficiency when I
> wrote that function, but I'm almost sure it is not
> supposed to eat all my memory. Do I need to say
> something to ghci if I want it to use all
> available memory?
>

You can start ghci with the -K option to increase the stack size --
ghci +RTS -K256m -RTS
for example, sets the maximum stack size to 256 MB. However, stack
overflows are usually (though not always) a sign of buggy code, as
they're often caused by infinite recursion, and you want to be
notified of that sooner rather than later.

Cheers,
Tim

-- 
Tim Chevalier * catamorphism.org * Often in error, never in doubt
"Live fast, love hard, and wear corrective lenses if you need them."
--Webb Wilder
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Stack overflow in ghci

2007-10-17 Thread Maurí­cio

Hi,

I get this error message when testing a function
in ghci:

 *** Exception: stack overflow

I admit I didn't care about efficiency when I
wrote that function, but I'm almost sure it is not
supposed to eat all my memory. Do I need to say
something to ghci if I want it to use all
available memory?

Thanks,
Maurício

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Stack overflow in ghci

2004-09-02 Thread Ron de Bruijn

--- Tomasz Zielonka <[EMAIL PROTECTED]>
wrote:

> On Thu, Sep 02, 2004 at 08:47:51AM -0700, Ron de
> Bruijn wrote:
> > I heard of the +RTS option. I used:
> > ghci SomeModule.hs -someoptions +RTS -K150,
> but
> > this doesn't seem to have any effect. 
> 
> Try +RTS -K150M.
> -K150 means 150 bytes.
> 
> Best regards,
> Tom
> 
> -- 
> .signature: Too many levels of symbolic links
> 
Ok, it works. I thought the K was equivalent to 1000,
but the first K doesn't have that meaning. Thanks.




__
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Stack overflow in ghci

2004-09-02 Thread Tomasz Zielonka
On Thu, Sep 02, 2004 at 08:47:51AM -0700, Ron de Bruijn wrote:
> I heard of the +RTS option. I used:
> ghci SomeModule.hs -someoptions +RTS -K150, but
> this doesn't seem to have any effect. 

Try +RTS -K150M.
-K150 means 150 bytes.

Best regards,
Tom

-- 
.signature: Too many levels of symbolic links
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Stack overflow in ghci

2004-09-02 Thread Ron de Bruijn
I have an expression that gives a stack overflow in
ghci (official Debian unstable CVS version)) when I
evaluate it. The expression doesn't use more than
150MB of memory (I have more). How can I make sure the
stack overflow doesn't happen?

There are no strictness flags in my program. But I use
DData Maps(I don't know whether they are implemented
strict). I also don't know whether strictness/lazyness
has anything do to with it.  

*SomeModule> test
*** Exception: stack overflow
(148.67 secs, 250825284 bytes)

Sometimes I get a negative number of bytes.

I heard of the +RTS option. I used:
ghci SomeModule.hs -someoptions +RTS -K150, but
this doesn't seem to have any effect. I think there
should be someother option to change it? 

Thanks in advance,
  Ron de Bruijn




__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe