@@ -43,21 +43,23 @@ impl<'a> AgentController<'a> {
43
43
}
44
44
45
45
impl < ' a > super :: MutAction for AgentController < ' a > {
46
- fn on_oom ( & mut self , jni_env : :: env:: JniEnv , resourceExhaustionFlags : :: jvmti:: jint ) {
47
- let heap_exhausted = :: jvmti:: JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP as :: jvmti:: jint ;
48
- let threads_exhausted = :: jvmti:: JVMTI_RESOURCE_EXHAUSTED_THREADS as :: jvmti:: jint ;
49
- if resourceExhaustionFlags & heap_exhausted == heap_exhausted {
46
+ fn on_oom ( & mut self , jni_env : :: env:: JniEnv , resource_exhaustion_flags : :: jvmti:: jint ) {
47
+ const heap_exhausted: :: jvmti:: jint = :: jvmti:: JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP as :: jvmti:: jint ;
48
+ const threads_exhausted: :: jvmti:: jint = :: jvmti:: JVMTI_RESOURCE_EXHAUSTED_THREADS as :: jvmti:: jint ;
49
+ const oom_error: :: jvmti:: jint = :: jvmti:: JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR as :: jvmti:: jint ;
50
+
51
+ if resource_exhaustion_flags & heap_exhausted == heap_exhausted {
50
52
eprintln ! ( "\n Resource exhaustion event: the JVM was unable to allocate memory from the heap." ) ;
51
53
}
52
- if resourceExhaustionFlags & threads_exhausted == threads_exhausted {
54
+ if resource_exhaustion_flags & threads_exhausted == threads_exhausted {
53
55
eprintln ! ( "\n Resource exhaustion event: the JVM was unable to create a thread." ) ;
54
56
}
55
57
56
58
if self . heuristic . on_oom ( ) {
57
59
for action in & self . actions {
58
- action. on_oom ( jni_env, resourceExhaustionFlags ) ;
60
+ action. on_oom ( jni_env, resource_exhaustion_flags ) ;
59
61
}
60
- } else {
62
+ } else if resource_exhaustion_flags & oom_error == oom_error {
61
63
eprintln ! ( "\n The JVM is about to throw a java.lang.OutOfMemoryError." ) ;
62
64
}
63
65
}
0 commit comments