From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 8B1D9BC0B for ; Tue, 26 Dec 2006 19:32:04 +0100 (CET) Received: from parmail02.sgcib.com (parmail02.sgcib.com [207.45.250.34]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id kBQIW3tw003178 for ; Tue, 26 Dec 2006 19:32:04 +0100 X-IronPort-AV: i="4.12,211,1165186800"; d="scan'208"; a="150011371:sNHT27951776" Content-class: urn:content-classes:message MIME-Version: 1.0 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: RE: [Caml-list] allocating memory for c-structures Date: Tue, 26 Dec 2006 19:32:00 +0100 Message-ID: <7625D6A1880B4C4DA11D2EBB8B43D2B9167B41@FRDEF-EXMB03.europe.am.socgen> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [Caml-list] allocating memory for c-structures Thread-Index: AccpGeu5A7hXFg6vSBi5Nwe2zMbabQAAW1jA From: "EL CHAAR Rabih SGAM/AI/SAM" To: "micha" Cc: "caml-list" X-OriginalArrivalTime: 26 Dec 2006 18:32:01.0481 (UTC) FILETIME=[224F8B90:01C7291C] X-NAI-Spam-Rules: 1 Rules triggered BAYES_00=-2.5 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-Miltered: at discorde with ID 45916AA3.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; allocating:01 ocaml:01 pointer:01 ocaml:01 allocating:01 malloc:01 interfacing:01 lib:01 malloc:01 cheers:01 beginner's:01 bug:01 freeing:98 interdite:98 altere:98 The issue about having c structures allocated in ocaml heap is about: 1) having a floating pointer that could be displaced by the gc during its c= ycles (if it is emedded into ocaml heap) 2) having it reside in the c heap, and not be impacted by caml gc cycles (t= his can be justified if the c structure is heavy in memory, like a c array,= =2E..): this is done by creating caml values with a custom or abstract tag. 3) memory freeing could always be done to a custom_tag value through the fi= nalization function passed during the creation. Hope this helps, Rabih -----Message d'origine----- De=A0: caml-list-bounces@yquem.inria.fr [mailto:caml-list-bounces@yquem.inr= ia.fr] De la part de micha Envoy=E9=A0: mardi 26 d=E9cembre 2006 19:16 =C0=A0: OCaml Mailing List Objet=A0: [Caml-list] allocating memory for c-structures Normaly I allocate memory for c-structures with malloc or with "new" for=20 c++ objects. Some time ago a read about a library which places external=20 structures in strings of the interfacing languages (it was a scheme lib=20 I think). So instead of using malloc or new I would allocate an=20 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? cheers Michael _______________________________________________ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs Ce message et toutes les pieces jointes (ci-apres le "message") sont confid= entiels et etablis a l'intention exclusive de ses destinataires.=20 Toute utilisation ou diffusion non autorisee est interdite.=20 Tout message electronique est susceptible d'alteration.=20 Societe Generale Asset Management et ses filiales declinent toute responsab= ilite au titre de ce message s'il a ete altere, deforme ou falsifie.=20 =20 Decouvrez l'offre et les services de Societe Generale Asset Management sur = le site www.sgam.fr=20 =20 ********=20 =20 This message and any attachments (the "message") are confidential and inten= ded solely for the addressees.=20 Any unauthorised use or dissemination is prohibited.=20 E-mails are susceptible to alteration.=20 Neither Societe Generale Asset Management nor any of its subsidiaries or af= filiates shall be liable for the message if altered, changed or falsified.=20 =20 Find out more about Societe Generale Asset Management's proposal on www.sga= m=2Ecom