The attached program (needs the Hugs Graphics Library) reveals what I
presume is a GC bug in the Dec 2001 hugs.
John
----- Original Message -----
From: "John Hughes"
Alastair, Just for a bit of fun, I solved the first programming lab on our Java course using HGL instead. You might like to run the attached program to see the result!
That's pretty cool. Thanks.
Give it a BIG heap, or you'll hit the same GC bug in Hugs that I did.
I do indeed need a big heap.
How do you know it's a GC bug and not just a space leak? If we can, I'd like to fix it if it's a bug (or even if it's not a 'bug' but can be fixed.)
Well, I get different behaviour depending on the heap size. For example, with a heap size of 250000,
Main> main
Thread raised exception: {{Cell ...}} Uncaught Error: {{Cell ...}}
or, in a fresh winhugs,
Main> foldr1 (.+) (take 10000 (points ()))
Program error: {primIntegerToInt (-2147483648)}
Repeating that, by the way, gives
Main> foldr1 (.+) (take 10000 (points ()))
ERROR - Garbage collection fails to reclaim sufficient space
With a heap size of 249999, I get¨
Main> main
ERROR - Garbage collection fails to reclaim sufficient space
Main> foldr1 (.+) (take 10000 (points ()))
Program error: {primIntegerToInt 352126429244364}
Behaviour that depends on the heap size looks like a GC bug to me.
I would have liked to pare the program down to a small one exhibiting the same problem, but that proved difficult. What I did discover is that the type signature on transform is crucial: removing it changes the behaviour, for reasons which are not at all clear to me.
Good luck with bug-hunting!
John
participants (1)
-
John Hughes