[Ecls-list] Declaring functions and shutting down ECL
Juan Jose Garcia-Ripoll
worm at arrakis.es
Tue Jun 10 08:14:10 UTC 2003
On Tuesday 10 June 2003 00:02, Julian St. wrote:
> On Mon, 9 Jun 2003 19:26:34 +0200
> Another question arose lately: Is it possible to "shut down" ECL? I am
> currently developing a plugin for X-Chat an loading it as shared library
> works fine, but after unloading it, all the memory is not freed.
Once you start ECL, there is currently no way to unload it. This is due to the
fact that I cannot control the internals of the Boehm-Weiser garbage
collector.
However, it should be relatively easy to implement this if you use the old
garbage collector. Here we know precisely how much memory was allocated, and
we can simply munmap() everything. Basically, you have to have a look at
alloc.d, and more precisely to the routine cl_resize_hole(), which is the one
that gets fresh memory for ECL.
The way in which mmap() is currently used is sort of a hack: ECL requires that
the blocks allocated be contiguous. Currently, an initial chunck of memory is
mmap()ed at an address which is supposed to be "safe". Further calls to
mmap() try to extend this block. If mmap() returns a pointer to a region of
memory which is not right after the previously allocated one, it fails. This
never seems to happen in Linux, but anyway it is a hack and it may break in a
near future.
Best regards,
Juanjo
More information about the ecl-devel
mailing list