From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id DD2F1BBAF for ; Mon, 23 Aug 2010 22:23:18 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiMFAL51ckzV+668/2dsb2JhbACTJ44EvXqCdYJCBIQ1iD4 X-IronPort-AV: E=Sophos;i="4.56,259,1280700000"; d="scan'208";a="66025837" Received: from rastageeks.org (HELO mail.rastageeks.org) ([213.251.174.188]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 23 Aug 2010 22:23:18 +0200 Received: from leonard.localnet (unknown [129.81.170.252]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.rastageeks.org (Postfix) with ESMTPSA id 4E6F245076 for ; Mon, 23 Aug 2010 22:38:52 +0200 (CEST) From: Romain Beauxis To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] caml_copy_string Date: Mon, 23 Aug 2010 15:24:48 -0500 User-Agent: KMail/1.13.5 (Linux/2.6.32-4-amd64; KDE/4.4.5; x86_64; ; ) References: <201008231409.06024.monnier.florent@gmail.com> In-Reply-To: <201008231409.06024.monnier.florent@gmail.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Message-Id: <201008231524.49124.toots@rastageeks.org> X-Spam: no; 0.00; ocaml:01 buffer:01 allocations:01 buffer:01 segfault:01 traded:98 caml-list:01 caml:02 string:02 string:02 lundi:05 ecrit:06 cases:08 function:08 reusing:09 Le lundi 23 ao=FBt 2010 07:09:05, Florent Monnier a =E9crit : > an alternative method is to provide a string from ocaml to c then c fills > this buffer, then you can save allocations by reusing the same buffer, > see: This is a good idea but I would be a little bit suspicious about using=20 "noalloc". Even if it works in your tests, this options is very delicate to= =20 use with the Gc, and may segfault in some cases. Beside, I think that the benefit of noalloc have to be traded off with the= =20 complexity of the function in terms of elementary instructions. Romain