CNI threads and garbage collection on FC4
Andi Vajda
andi@osafoundation.org
Fri Aug 26 21:34:00 GMT 2005
> I'm using CNI to convert C++ objects (data only, no methods) into java
> objects and pass them over the network to java programs using
> serialization. It works fine on my older machines with various versions
> of GCC 3.x, but it causes a problem on my FC4 machine which has GCC
> 4.0.1 and libgcj 4.0.1.
>> I create several threads using pthread_create from C++ and I call
> JvAttachCurrentThread(NULL, NULL) in each of them. The problem is when I
> create new java objects libgcj throws an exception and prints
>> Collecting from unknown thread.
> Aborted
>> I am sure that I only create java objects in threads that called
> JvAttachCurrentThread(NULL, NULL) when they started. And this works on
> all my machines except FC4.
>> Does anyone have any ideas? Is it possible to disable garbage collection
> in CNI and delete the java objects manually? I need this code to work on
> all recent distributions for it to be useful.
You cannot create a thread and pass it to java after the fact. The gc
subsystem doesn't support that, yet. Hans Boehm, its author, intends to
support this eventually....
Andi..
More information about the Java
mailing list