Skip to main content

GC freezing JNI invocation - why?

No replies
sabroe
Offline
Joined: 2006-11-02

- When garbage collection is running two things seem to be put on hold: The allocation of new objects and the invocation between Java and C through JNI.

What are the reason that a JVM-attached thread running in C can not call Java during the time of running garbage collection? The entry to Java is somehow synchronized with the garbage collection (just as regular object allocation) and put on hold until garbage collection is finished. Why is this?

Is the blocking of JNI invocations (Java to C and C to Java) during the time of garbage collection really necessary?

I would like threads to keep running - and in particular during garbage collection - for statically allocating programs and over JNI. Apparently this is not possible. Does, say, the new G1 have any hidden options to circumvent the freeze of JNI?