[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2006-12-26 (18:33) |
From: | skaller <skaller@u...> |
Subject: | Re: [Caml-list] allocating memory for c-structures |
On Tue, 2006-12-26 at 19:15 +0100, micha wrote: > Normaly I allocate memory for c-structures with malloc or with "new" for > c++ objects. Some time ago a read about a library which places external > structures in strings of the interfacing languages (it was a scheme lib > I think). So instead of using malloc or new I would allocate an > ocaml-string and put the c-structure there. So it will be free by the gc. > That seems o.k. for me, any comments? I'm missing something? I don't believe Ocaml guarantees the contents of a string will remain in a fixed location .. it might move the storage to a new address .. so pointers into the structure might dangle. -- John Skaller <skaller at users dot sf dot net> Felix, successor to C++: http://felix.sf.net