Proposal: Pooled memory management

Sven Panne Sven.Panne at informatik.uni-muenchen.de
Sat Jan 18 08:22:32 EST 2003


The FFI libraries currently contain support for explicit allocation
and deallocation via the malloc/free family and support for implicit
allocation and deallocation via alloca and friends. But there is a
very useful level between these extremes: Pooled memory management.
Under this scheme, (re-)allocations belong to a given pool, and
everything in a pool is deallocated when the pool itself is
deallocated.

You can find the implementation and the (lean) docs at:

    http://haskell.org/HOpenGL/PoolRFC/Pool.hs
    http://haskell.org/HOpenGL/PoolRFC/html/Foreign.Marshal.Pool.html

I propose adding this module to FFI addendum and the exports of module
Foreign.Marshal. Although the module is definitely not a candidate for
the next ACM award, it's a useful and common abstraction which can
easily be implemented on the existing FFI modules.

Comments?

Cheers,
    S.




More information about the FFI mailing list