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 HAA29720; Mon, 24 Mar 2003 07:15:41 +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 HAA29537 for ; Mon, 24 Mar 2003 07:15:40 +0100 (MET) Received: from psyche.kaba.or.jp (psyche.kaba.or.jp [202.249.19.1]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h2O6FbX13284; Mon, 24 Mar 2003 07:15:38 +0100 (MET) Received: from mail.kaba.or.jp (cascade.kaba.or.jp [202.249.19.34]) by psyche.kaba.or.jp (Postfix) with ESMTP id 878BC229E9; Mon, 24 Mar 2003 15:15:36 +0900 (JST) Received: from WARP (dhcp04.kaba.or.jp [202.249.19.39]) by mail.kaba.or.jp (Postfix) with SMTP id 63CDB49A6B; Mon, 24 Mar 2003 15:15:36 +0900 (JST) Message-ID: <006201c2f1cc$a910ad20$2713f9ca@WARP> From: "Nicolas Cannasse" To: "Markus Mottl" , "Damien Doligez" Cc: "OCAML" References: <20030320151647.GA15121@fichte.ai.univie.ac.at> <4DE5D5EC-5BB8-11D7-856E-0003930FCE12@inria.fr> <20030321163508.GA10107@kiefer.ai.univie.ac.at> Subject: Re: [Caml-list] GC and preventing data relocation Date: Mon, 24 Mar 2003 15:14:42 +0900 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Spam: no; 0.00; cannasse:01 warplayer:01 caml-list:01 buffer:01 callback:01 c-code:01 overwriting:01 dynamically:01 ocaml:01 nicolas:01 string:03 heap:03 allocate:03 data:03 preventing:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > > If the string is in the minor heap, you know it's a short string and > > you can (for example) copy it into a buffer pre-allocated in the C heap. > > Unfortunately, this won't work, because the callback may again call the > C-code, either overwriting the buffer or requiring me to write my own > memory management. I don't think the latter is worthwhile so I'll just > dynamically allocate buffers as required. So, what about running a full_major, that should empty the minor heap and move your string into the major heap. Or else, explicity create a major heap ocaml block and copy the string into it ( in not already in major heap ). Nicolas Cannasse ------------------- 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