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 QAA26216; Thu, 20 Mar 2003 16:16:53 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA26088 for ; Thu, 20 Mar 2003 16:16:50 +0100 (MET) Received: from fichte.ai.univie.ac.at (fichte.ai.univie.ac.at [131.130.174.156]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h2KFGmf20306 for ; Thu, 20 Mar 2003 16:16:48 +0100 (MET) Received: from fichte.ai.univie.ac.at (markus@localhost.ai.univie.ac.at [127.0.0.1]) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-5) with ESMTP id h2KFGlV7016435 for ; Thu, 20 Mar 2003 16:16:47 +0100 Received: (from markus@localhost) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-5) id h2KFGlDN016434 for caml-list@inria.fr; Thu, 20 Mar 2003 16:16:47 +0100 Date: Thu, 20 Mar 2003 16:16:47 +0100 From: Markus Mottl To: OCAML Subject: [Caml-list] GC and preventing data relocation Message-ID: <20030320151647.GA15121@fichte.ai.univie.ac.at> Mail-Followup-To: OCAML Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i Organization: Austrian Research Institute for Artificial Intelligence X-Spam: no; 0.00; pcre-ocaml:01 callbacks:01 c-library:01 closures:01 ocaml-code:01 ocaml:01 workaround:01 mottl:02 string:03 library:03 data:03 markus:04 array:04 preventing:05 oefai:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello, I have just started to integrate a new feature into PCRE-OCaml that would allow callbacks ("callouts") during pattern matching. However, if I'm not mistaken, there is a severe problem for which I don't know any good workaround: Among other things, my C-function gets a string value and passes it to a C-library for pattern matching together with information on what to do in the case of "callouts" in the regular expression. If the C-engine detects such an indicator, my wrapper code is called again and receives the callout data (e.g. an array of callout closures provided by the OCaml-code). When my code calls OCaml again via one of those closures, this may, of course, trigger the GC. Unfortunately, the GC may feel like moving data around, e.g. the string which is currently still in use by the C-engine of the library. Needless to say that this may cause trouble! Copying the string internally into the C-heap to prevent this would be really bad due to performance/memory reasons... Since there is no way for me to tell the C-library to continue with a new location of the string, I'd like to know whether there is any way to prevent the GC from moving specific data? Best regards, Markus Mottl -- Markus Mottl markus@oefai.at Austrian Research Institute for Artificial Intelligence http://www.oefai.at/~markus ------------------- 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