From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA17771; Fri, 30 Jan 2004 21:55:24 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA18131 for ; Fri, 30 Jan 2004 21:55:22 +0100 (MET) Received: from mail5.tpgi.com.au (mail.tpgi.com.au [203.12.160.100]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id i0UKtLv05783 for ; Fri, 30 Jan 2004 21:55:21 +0100 (MET) Received: from syd-ts18-2600-163.tpgi.com.au (syd-ts18-2600-163.tpgi.com.au [203.58.21.163]) by mail5.tpgi.com.au (8.12.10/8.12.10) with ESMTP id i0UKt9JZ023343; Sat, 31 Jan 2004 07:55:10 +1100 Subject: Re: [Caml-list] CamlDL/Abstract pointers problem From: skaller Reply-To: skaller@tpg.com.au To: Brian Hurt Cc: Jacques Garrigue , rich@annexia.org, caml-list In-Reply-To: References: Content-Type: text/plain Message-Id: <1075496184.23595.77.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 31 Jan 2004 07:56:25 +1100 Content-Transfer-Encoding: 7bit X-TPG-Antivirus: Passed X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 pointers:01 tpg:99 2004:99 jacques:01 pointers:01 glue:01 initialise:01 malloc:01 tpg:99 glebe:01 2037,:01 9660:01 ocaml:01 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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