I encountered the problem that a partially computed infinite list fills up
the heap, and that Hugs fails to release it. I use the MacPPC port I made,
but I gather it does not have anything to do with the port, but with the
Hugs kernel itself.

The file "fib.hs" contains the following definition of Fibonacci number as
an infinite list:
fib     :: [Integer]
fib     = 1 : 1 : [ a+b | (a,b) <- zip fib (tail fib) ]

Then I get the following session with Hugs:
---------------------------------------------------------
Prelude> :l ::HA:fib
Reading file "::HA:fib.hs":

Hugs session for:
:lib:Prelude.hs
::HA:fib.hs
Main> fib !! 1000
70330367711422815821835254877183549770181269836358732742604905087154537118196933
57974224949456261173348775044924176599108818636326545022364710601205337412127386
7339111198139373125598767690091902245245323403501
Main> fib !! 10000

ERROR: Garbage collection fails to reclaim sufficient space
Main> fib !! 10
89
ERROR: Garbage collection fails to reclaim sufficient space
Main> :gc
ERROR: Garbage collection fails to reclaim sufficient space
---------------------------------------------------------

It appears that once Hugs has filled up the heap with partial computations
of the infinite list "fib", it keeps it there, and does not release it no
matter what.

  Hans Aberg
                  * Email: Hans Aberg <mailto:[EMAIL PROTECTED]>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>

Reply via email to