Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] GC and preventing data relocation
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Cannasse <warplayer@f...>
Subject: Re: [Caml-list] GC and preventing data relocation
> > 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