
Don Stewart ha scritto:
manlio_perillo:
Don Stewart ha scritto:
[...]
So the question is: why appending an array of only one element to an existing array causes memory problems?
It must copy the entire array.
Isn't it the same with snocU?
And, since the final result is the same, what happens to the temporary memory used for array copying?
I have executed the program with: +RTS -A128M -s -c -F1.1 -RTS
The memory seems to leak.
Send me a test case.
http://hpaste.org/fastcgi/hpaste.fcgi/view?id=3071 But Claus was right, appendU is lazy; this seems to be the cause of the problem. However now I don't really understand why the two implementations differs in lazyness. Or, to ask a different question, how can I make the version using insertWith strict? Thanks Manlio