[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C++ extension and garbage collection
At Mon, 25 Mar 2002 11:11:28 -0800 (PST), Ron Stanonik wrote:
> I'm working on a DrScheme (plt-200aplha14) extension, written in C++.
>
> It appears that DrScheme's garbage collection might be "collecting"
> some of the extension's C++ objects.
Aha --- in our earlier correspondence, I didn't catch or consider that
your code was C++. Sorry about that.
> Watching with gdb when the C++ objects are new'ed I see that DrScheme
> has overridden the "new" operator and that this "new" operator is
> calling GC_malloc.
Yes, right.
> Shouldn't this "new" be calling GC_malloc_uncollectable? Or is there some
> other way I should be indicating to DrScheme to not collect the extension's
> C++ objects? Or have I built DrScheme incorrectly?
DrScheme (or, more precisely, MrEd) should probably not redefine the
global `new' for C++ code. I noticed this problem a long time ago, but
didn't do anything about it at the time, and then I forgot.
I'm not sure how to fix MrEd (as least not easily), but I wonder
whether you can avoid the problem by statically linking your extension
to the C++ runtime?
Matthew