Version française
Home     About     Download     Resources     Contact us    
Browse thread
caml_copy_string
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Till Varoquaux <till@p...>
Subject: Re: [Caml-list] caml_copy_string
On Tue, Aug 24, 2010 at 10:21 AM, Florent Monnier
<monnier.florent@gmail.com> wrote:
> Le lundi 23 août 2010 22:24:48, Romain Beauxis a écrit :
>> Le lundi 23 août 2010 07:09:05, Florent Monnier a écrit :
>> > 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
>> "noalloc". Even if it works in your tests, this options is very delicate to
>> use with the Gc, and may segfault in some cases.
>
> could you develop? which cases?

IIRC noalloc calls release the ocaml lock. This means that the runtime
can run at the same time as the c call and the GC migh collect your
string or move it along. Quick rule if thumb is: you are allocating
your string so you should not use noalloc.
Till
>
>
> --
> Regards
> Florent
>
> _______________________________________________
> 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
>