why jvm crashes if I invoke GC every 20000 allocations
843829Apr 8 2006 — edited Apr 11 2006I am doing a project related to object's lifetime. I modified JVM code to force it to do garbage collection every 20000 allocations (i.e., every 20000 objects have been allocated). In my code, I used a global variable total_objs to track how many objects have been allocated so far.
I added the following code at every allocation time ( in function jvmpi_object_alloc() of universe.cpp)
if( total_objs% GCFreq == 0) //GCFreq=20000 here
Universe::heap()->collect(GCCause::_java_lang_system_gc);
}
But JVM will always failed. Even I enlarge GCFreq, VM still crashed. Why????????
Feng