ブールPSScavenge :: invoke_no_policy()
...
if (GCLocker::check_active_before_gc()) {
return false;
}
...
あなたが見ることができるようにGCLocker::check_active_before_gc()
がtrue
であれば、それはPSScavenge::invoke_no_policy()
ある、マイナーGCを起動しません。それはなぜです?なぜJNIアクティブインスタンスはGCを防止しますか?
check_active_before_gc()
bool GCLocker::check_active_before_gc() {
assert(SafepointSynchronize::is_at_safepoint(), "only read at safepoint");
if (is_active() && !_needs_gc) {
verify_critical_count();
_needs_gc = true;
log_debug_jni("Setting _needs_gc.");
}
return is_active();
}
is_active()
// Accessors
static bool is_active() {
assert(SafepointSynchronize::is_at_safepoint(), "only read at safepoint");
return is_active_internal();
}
is_active_internal()
static bool is_active_internal() {
verify_critical_count();
return _jni_lock_count > 0;
}
_jni_lock_count
static volatile jint _jni_lock_count; // number of jni active instances.
_jni_lock_count
は、現在重要な領域にある であるスレッドの数を追跡します。