caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Storing ocaml values outside ocaml's heap
@ 2011-12-08  4:35 William Le Ferrand
  2011-12-08  6:04 ` Stéphane Glondu
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: William Le Ferrand @ 2011-12-08  4:35 UTC (permalink / raw)
  To: caml users

[-- Attachment #1: Type: text/plain, Size: 1202 bytes --]

Dear list,

We are building a cache in ocaml and we're wondering if it would make sense
to store ocaml values outside the reach of the gc. (gc on a 20GB cache
hangs the process for a second or so).

To run some experiments, we wrote a small library (
https://github.com/besport/ocaml-everlasting) that exposes two functions,
get and set.

When inserting a value, we copy recursively the blocs outside of the reach
of the gc (and put the resulting value in some C array). When getting the
value, we simply pass the pointer to the copied value to the ocaml code
(the structure is still coherent and the value is directly usable). We also
wrote an "update" function that compare a new value with the existing value
in cache, to avoid unnecessary memory allocation/deallocation.

It does not seems very stable though, but I don't know if it is a bug in
the update function or simply because this approach is not reasonable. Do
you have any thoughts? Is there any clever way to build a large cache in an
ocaml app ?

Thanks in advance for any tips!

Best

William


-- 
William Le Ferrand

Mobile : (+1) (415) 683-1484
Web : http://williamleferrand.github.com/
<http://www.linkedin.com/in/williamleferrand>

[-- Attachment #2: Type: text/html, Size: 1844 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-12-08 17:03 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-08  4:35 [Caml-list] Storing ocaml values outside ocaml's heap William Le Ferrand
2011-12-08  6:04 ` Stéphane Glondu
2011-12-08  8:19   ` William Le Ferrand
2011-12-08  9:04     ` Anil Madhavapeddy
2011-12-08  9:07       ` William Le Ferrand
2011-12-08 11:03       ` oliver
2011-12-08 17:02         ` Goswin von Brederlow
2011-12-08  9:40   ` Gaius Hammond
2011-12-08  8:49 ` Anders Fugmann
2011-12-08  8:56   ` William Le Ferrand
2011-12-08  9:29     ` Anders Fugmann
2011-12-08  9:12 ` Gerd Stolpmann
2011-12-08 10:33 ` Goswin von Brederlow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).