Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] CamlDL/Abstract pointers problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@t...>
Subject: Re: [Caml-list] CamlDL/Abstract pointers problem
On Fri, 2004-01-30 at 18:04, Brian Hurt wrote:
> On Fri, 30 Jan 2004, Jacques Garrigue wrote:
> 
> > However, there is another scenario which could cause you problems:
> > if for some reason your C pointer get freed, and later the ML heap is
> > extended so that it includes the address of the pointer, then you may
> > have some pointers left on the ML which will now be seen as ML
> > pointers.
> 
> ML doesn't memset memory it just allocated?  

It doesn't need to .. all values are initialised (in Ocaml).
When writing C/Ocaml glue, you have to be careful
that you *do* initialise all values before possibly triggering
the collector.. 

> This may be a problem- I 
> don't *think* the C standard requires malloc to memset the memory itself, 

it doesn't. The function which does do that is
called 'calloc'.

-- 
John Max Skaller, mailto:skaller@tpg.com.au
snail:25/85c Wigram Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850. Checkout Felix: http://felix.sf.net




-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners