Sorry if this has been raised before, I don't really follow this list. According to section 5.8 of the spec, MarshalAlloc.free will "free a block of memory that was allocated with malloc or mallocBytes". Fine. But will it also free blocks of memory allocated by MarshalArray.mallocArray and friends? Come to think of it, what about MarshalArray.reallocBytes? Also, what is the "realloc" function mentioned in the specification of reallocArray, or do you mean reallocBytes?
George Russell <ger@tzi.de> wrote,
According to section 5.8 of the spec, MarshalAlloc.free will "free a block of memory that was allocated with malloc or mallocBytes". Fine. But will it also free blocks of memory allocated by MarshalArray.mallocArray and friends?
Yes, `mallocArray' is just a wrapper around `mallocBytes'.
Come to think of it, what about MarshalArray.reallocBytes?
That can be free'd with `MarshalAlloc.free', too.
Also, what is the "realloc" function mentioned in the specification of reallocArray, or do you mean reallocBytes?
Yes, `rallocBytes' is meant, but thinking about it, we might actually add a function: realloc :: Storable b => Ptr a -> IO (Ptr b) I think, it is more orthogonal this way. Any objections? Cheers, Manuel PS: I'll make sure that these points are clarified in the FFI spec.
participants (2)
-
George Russell -
Manuel M. T. Chakravarty