garbage collection and Ptr/ForeignPtr/StablePtr

Bayley, Alistair Alistair_Bayley at
Mon Sep 22 13:10:36 EDT 2003

Should I expect that Ptr memory allocated with malloc is garbage collected
when no longer used by the Haskell runtime? The FFI spec doesn't say so
explicitly (that I could see); AFAICT this is how the pointer types behave:
  Ptr : freed when no longer used/referenced
  ForeignPtr : like Ptr, but will also run a finaliser when freed
  StablePtr : not freed or collected

(I haven't tested this; I've only read the FFI spec.)

The information in this email and in any attachments is 
confidential and intended solely for the attention and use 
of the named addressee(s). This information may be 
subject to legal professional or other privilege or may 
otherwise be protected by work product immunity or other 
legal rules.  It must not be disclosed to any person without 
our authority.

If you are not the intended recipient, or a person 
responsible for delivering it to the intended recipient, you 
are not authorised to and must not disclose, copy, 
distribute, or retain this message or any part of it.

More information about the Haskell-Cafe mailing list