diff --git a/native/common/jp_gc.cpp b/native/common/jp_gc.cpp index b448cc8d1..6d2a47ce0 100644 --- a/native/common/jp_gc.cpp +++ b/native/common/jp_gc.cpp @@ -154,8 +154,8 @@ void JPGarbageCollection::init(JPJavaFrame& frame) _SystemClass = (jclass) frame.NewGlobalRef(frame.FindClass("java/lang/System")); _gcMethodID = frame.GetStaticMethodID(_SystemClass, "gc", "()V"); - jclass ctxt = frame.getContext()->m_ContextClass.get(); - _ContextClass = ctxt; + jclass ctxt = frame.getContext()->m_ContextClass.get(); + _ContextClass = ctxt; _totalMemoryID = frame.GetStaticMethodID(ctxt, "getTotalMemory", "()J"); _freeMemoryID = frame.GetStaticMethodID(ctxt, "getFreeMemory", "()J"); _maxMemoryID = frame.GetStaticMethodID(ctxt, "getMaxMemory", "()J"); @@ -247,21 +247,21 @@ void JPGarbageCollection::onEnd() if ((Py_ssize_t) pred > (Py_ssize_t) limit) { run_gc = 2; - limit = high_water + (high_water>>3) + 8 * (current - last); - } + limit = high_water + (high_water>>3) + 8 * (current - last); + } #if 0 - { + { JPJavaFrame frame = JPJavaFrame::outer(m_Context); - jlong totalMemory = frame.CallStaticLongMethodA(_ContextClass, _totalMemoryID, nullptr); - jlong freeMemory = frame.CallStaticLongMethodA(_ContextClass, _freeMemoryID, nullptr); - jlong maxMemory = frame.CallStaticLongMethodA(_ContextClass, _maxMemoryID, nullptr); - jlong usedMemory = frame.CallStaticLongMethodA(_ContextClass, _usedMemoryID, nullptr); - jlong heapMemory = frame.CallStaticLongMethodA(_ContextClass, _heapMemoryID, nullptr); + jlong totalMemory = frame.CallStaticLongMethodA(_ContextClass, _totalMemoryID, nullptr); + jlong freeMemory = frame.CallStaticLongMethodA(_ContextClass, _freeMemoryID, nullptr); + jlong maxMemory = frame.CallStaticLongMethodA(_ContextClass, _maxMemoryID, nullptr); + jlong usedMemory = frame.CallStaticLongMethodA(_ContextClass, _usedMemoryID, nullptr); + jlong heapMemory = frame.CallStaticLongMethodA(_ContextClass, _heapMemoryID, nullptr); printf("consider gc run=%d (current=%ld, low=%ld, high=%ld, limit=%ld) %ld\n", run_gc, - current, low_water, high_water, limit, limit - pred); - printf(" java total=%ld free=%ld max=%ld used=%ld heap=%ld\n", totalMemory, freeMemory, maxMemory, usedMemory, heapMemory); - } + current, low_water, high_water, limit, limit - pred); + printf(" java total=%ld free=%ld max=%ld used=%ld heap=%ld\n", totalMemory, freeMemory, maxMemory, usedMemory, heapMemory); + } #endif if (run_gc > 0)