memory corruption

It's not a pull request.  I've just saw your request today.

General advice: 
Use Gc.compact, not just Gc.full_major. And put it in a often called
function of your library code, not only at application level. I always
overlay any suspicious function with a wrapper of this scheme:

```ocaml
 let f .. =
   Gc.compact ();
   let x = f .. in
   Gc.compact ();
   x
```
And then run your application with valgrind. Valgrind did find this error instantly.