Re: Is this a bug in multithreading code?

Il 22:54, mercoledì 23 aprile 2003, hai scritto:
I conjecture that the problem would go away if you added appropriate uses of seq or $! to your program so that the value stored in the MVar was always fully evaluated
You are right, the following code works well strictIncM x = return $! x + 1 ... forkIO (loopM (modifyMVar_ v strictIncM)) ... Thanks for your help Vincenzo

Alastair writes:
I conjecture that the problem would go away if you added appropriate uses of seq or $! to your program so that the value stored in the MVar was always fully evaluated
Nick Name
You are right, [...]
I further conjecture that more than half of all space leaks can be identified not by profiling your code but by running the following command: grep '+1' *.hs *.lhs I'm half joking but I've found that this one is very common in certain kinds of code. Every now and then I think of extending Hugs with unpointed Ints which would be identical in syntax and semantics to GHC's unboxed Ints but would have a different representation. -- Alastair
participants (2)
-
Alastair Reid
-
Nick Name