<div>&gt; Your code is broken in a most evil and insidious way.</div>
<div>&nbsp;</div>
<div>Interesting.&nbsp; This is for a toy project, so I&#39;m not too worried, but lets say I wanted to do this &quot;correctly&quot; and I was set on using IOUArray for some reason. (The Haskell wiki claims that StorableArray is slower; is that actually the case?)
</div>
<div>&nbsp;</div>
<div>Which of the following fixes would work now?&nbsp; Which has the lowest probability of not working in the future?</div>
<div>&nbsp;</div>
<div>1) Declare f to take Addr# and don&#39;t construct a Ptr Word32</div>
<div>&nbsp;&nbsp;&nbsp; I suspect this would be&nbsp;enough unless the GC changed to some sort of continous GC which can happen even without an allocation</div>
<div>&nbsp;</div>
<div>2) Declare f to take MutableByteArray#</div>
<div>&nbsp;&nbsp;&nbsp; Is this good enough to make the&nbsp;collector happy?</div>
<div>&nbsp;</div>
<div>3) Something else I haven&#39;t thought of?</div>
<div>&nbsp;</div>
<div>If there was no other option, and StorableArray wasn&#39;t slower, and I was working on a real project, I&#39;d probably wrap my own around ForeignPtr like Data.ByteString.</div>
<div>&nbsp;</div>
<div>&nbsp; -- ryan</div>
<div>&nbsp;</div>