Java Object allocation from C++ and references?
Andrew Haley
aph@redhat.com
Wed Feb 4 14:24:00 GMT 2004
Mohan Embar writes:
> Hi Andrew,
>
> >Mixing C++ classes and gcj classes isn't impossible, but I'd not say it was a
> >good idea.
>
> My C++ helper classes _Jv_Win32TempString, WSAEventWrapper (win32.h)
> and _Jv_TempUTFString (jvm.h), which rely on stack-based destructors to
> free resources, have all come running to me with frightened looks in their eyes
> asking me to ask you what you mean by this.... :)
Oh, don't worry. I was just talking about the conflict between C++
dynamic allocations schemes like reference counting and libgcj's
garbage collection. A problem occurs when a C++ struct that the gc
doesn't know about includes a reference to a Java object that gets
reclaimed. Stack allocated structs won't be a problem, because we
conservatively scan the stack.
Andrew.
More information about the Java
mailing list