Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Inhibiting heap compaction
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-06-02 (19:39)
From: Florian Weimer <fw@d...>
Subject: Inhibiting heap compaction
Is it possible to prevent the heap from being compacted, or pin
individual objects?

Suppose I write a C function C_func, which takes a string argument.
It passes that argument to some library function lib_func (which has
been written by a third party).  bar invokes a C callback C_cb.  In my
wrapper for Caml, C_cb invokes the Caml function cb.  cb conses and
triggers heap compaction.  After return from cb and C_cb, bar uses the
old address of the string, which is incorrect.

Currently, I copy all strings used in such a scenario, but this adds
quite a bit of overhead.