Hello,

2010/10/12 Alexey Rodriguez <mrchebas@gmail.com>
On Fri, Oct 8, 2010 at 3:48 PM, Mathias Kende <mathias.kende@ens.fr> wrote:

> Exception are some complex datastructure which may require additional
> care when marshalled. An example of which are the graphs of the
> ocamlgraph library (even the functional one), but there is none in the
> standard library.

Mathias, can you elaborate on "additional care"? We are using the
functional graphs from ocamlgraph, so I am very interested in your
experiences with it.

To my knowledge, issues come with the so-called "abstract" graphs from OcamlGraph in which vertices have unique ids.
1) if there are abstract vertices in RAM while unmarshalling some others, you have to be sure that RAM vertices do not share ids with unmarshalled ones (except if you really want that).
2) Before creating new abstract vertices, you have to set the global id counter Graph.Blocks.cpt_vertex in the right way (by marshalling it and by calling Graph.Blocks.after_unserialization after unmarshalling).
I'm not aware of any other (un)marshalling issue with OcamlGraph datastructures.

Beyond OcamlGraph, similar issues potentially exist for any datastructure which uses unique ids as keys and/or hashconsing techniques. For instance, a quite big job is done for solving this issue in Frama-C (http://frama-c.com) which uses many hashconsed datastructures (included abstract ocamlgraph vertices, but only the above-mentioned issue 2 applies in the Frama-C context)

Hope this helps,
Julien Signoles