kde and garbage collectors

Michael Matz matz at kde.org
Thu Aug 15 20:34:39 BST 2002


On Thu, 15 Aug 2002, Joseph Wenninger wrote:

> I noticed that that garbage collector only works, if the application
> itself is linked against libgc. If only the dlopened library is linked
> against libgc, it causes a crash. :((

Better search for the cause of this.  Do those libs using libgc replace
malloc and friends, or do they use the gc_xxx functions directly?  If the
latter (and only then we can hope to have libgc linked to kdeinit) I
wonder what would cause a crash when dlopen'ing.  Possibly it's the
RTLD_LOCAL with which our plugins are loaded normally?  You would then
need to dlopen libgc with RTLD_GLOBAL before loading the plugin.

> I don't know, but I think it could be interesting for third party
> applications too, to be able to use a gc. Therefor my question. Would
> it be a big problem if kdeinit is linked against libgc, on systems,
> where libgc exists ?

My initial reaction to that would be: no way.  libgc basically doesn't
exist on any system per default, and maintaining our own copy of it would
be a nightmare.  No, the right thing is to look for the cause of the
crashes with dlopen.  If it's just a library it should work.  If not we
could try other solutions.

> We link against libpthread too, although hardly anyone uses it.

That's a system library.  And we don't link against libpthread, but
instead activate threading.  For some platforms this simply means to link
against a different libc, for others it means no change at all.  And
threads are a POSIX interface, completely different from boehm GC.


More information about the kde-core-devel mailing list