Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Freeing allocated C-memory by GC (destructors)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-01-23 (16:46)
From: Oliver Bandel <oliver@f...>
Subject: Freeing allocated C-memory by GC (destructors)

after using some non-permanent allocating C-stuff
together with OCaml, I think about going one step further and
now have allocated memory from C represented as OCaml-variables
(in the concrete example I have married some of my C-stuff that
uses jpeglib to get information from picture-files, and
now think about representing complete picture-data as

So, I want to have the possibility to have malloced/calloced
data avaliable in OCaml, and that the GC calls C-destructor-
functions (using free(3)) when the values are of no use anymore.

How to say the GC, which is the destructor-functions
for a variable, which has been created?