[Haskell-cafe] Re: How to automatically free memory allocated by malloc? and how to reliably realloc such buffer?

2006-05-24 Thread Simon Marlow
Bulat Ziganshin wrote: Wednesday, May 24, 2006, 2:08:10 PM, you wrote: fptr <- newForeignPtr fin nullPtr return (Mem bufRef ... fptr) I hope you surround each use of the actual Ptr with 'withForeignPtr'? If so, I imagine this is safe. no, i hope that fptr's finalizers will be no e

[Haskell-cafe] Re: How to automatically free memory allocated by malloc? and how to reliably realloc such buffer?

2006-05-24 Thread Simon Marlow
Bulat Ziganshin wrote: my program uses datastructure that contains plain Ptr, this Ptr points to the memory area allocated by 'malloc': createRawMemBuf size = do buf<- mallocBytes (fromIntegral size) bufRef <- newURef buf ... return (Mem bufRef ...) i need to free this memo