Hello caml-list. I'm new here, It's my fist post, and I want to share an hack I came up with to systematically solve some marshalling problems I have in the context of Coq development. I hope the hack is of general interest, maybe it is folklore, maybe not... The Coq architecture is switching to a multi process one, where slave processes are fed a system state, a portion of the proof script (an entire proof at the moment) and are expected to return the resulting proof term. Data is marshalled using the standard Marshal module. The system state is made of pretty much anything, and is also user extensible via plugins. Nothing prevents someone to stick in there values that can hardly be marshalled, like callbacks, file descriptors, lazy_t, and the like. Of course it is nice to be able to store callbacks or lazy values in the system state, so forbidding all that is not nice. Luckily enough, I don't need this data in the slave processes. Hence I could pre-process the system state and throw it away. But the system state is big, and traversing it to prune out some bits is likely to be expensive. Moreover I'm lazy, I don't want to code that pruning function, hence the following solution. Values that can't, or should not, be marshalled are stored in the system state using a unique key, and given a key one can retrieve the corresponding value. These (key,value) pairs are ephemeron, if the key is not reachable, the value (if it has no extra references) will be eventually collected too. When a key is marshalled, no error occurs (keys are just doubly boxed integers). When a key is unmarshalled it becomes invalid, i.e. the associated value cannot be retrieved anymore. In some sense it is like if marshalling was forgetting the part of the marshalled value that is stored as a key. All automatically, no need to pre/post process the marshalled value and no extra memory management hassle. Thanks to Damien Doligez for his preliminary comments on the attached files. All sort of comments is welcome, Cheers -- Enrico Tassi