[Ecls-list] "socket crash bug" im Vim+ECL fixed

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Sun Jun 18 08:17:39 UTC 2006


2006/6/18, Larry Clapp <larry at theclapp.org>:
> I fixed the "socket crash bug" in Vim+ECL, and I think I discovered
> what caused it (in that order!).

Great news!

> Look closely at ADD-INPUT-LISTENER, above.  Notice that Jim puts the
> callback into a hash table (so some Lisp datastructure will have a
> reference to it, so the GC won't collect it), and then wraps a list
> around it and gives Vim a pointer to the list, which we later EVAL.
> (Now see there?  I've just about given it away!  :)  The *callback* is
> in the hashtable, but the *list around it isn't*!  And nothing else
> references it, either!  One GC later and it's game over.

Sometimes the weirdest problems have the simplest solutions :-)

If you want to leave these problems for the end of the development,
you can instruct the garbage collector to scan all memory. I think the
flag is GC_no_dls = 0 and you also have to remove the GC_clear_roots()
from the file alloc_2.d. This will make the garbage collector even
more conservative. If together with this you force VIM to call
GC_malloc() instead of malloc(), then you will have a safer version.
Whenever something crashes, you can compare with the conservative and
the ordinary versions.

Regards,

Juanjo




More information about the ecl-devel mailing list