File tree Expand file tree Collapse file tree 4 files changed +9
-10
lines changed
core/src/main/java/com/taobao/arthas/core/command/monitor200 Expand file tree Collapse file tree 4 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -117,9 +117,9 @@ public Class<?>[] getAllLoadedClasses() {
117
117
}
118
118
119
119
@ Override
120
- public boolean mallocTrim () {
120
+ public int mallocTrim () {
121
121
return mallocTrim0 ();
122
122
}
123
123
124
- private static synchronized native boolean mallocTrim0 ();
124
+ private static synchronized native int mallocTrim0 ();
125
125
}
Original file line number Diff line number Diff line change @@ -61,5 +61,5 @@ public interface VmToolMXBean {
61
61
/**
62
62
* glibc 释放空闲内存
63
63
*/
64
- public boolean mallocTrim ();
64
+ public int mallocTrim ();
65
65
}
Original file line number Diff line number Diff line change @@ -210,12 +210,10 @@ JNIEXPORT jobjectArray JNICALL Java_arthas_VmTool_getAllLoadedClasses0
210
210
}
211
211
212
212
extern " C"
213
- JNIEXPORT jboolean JNICALL Java_arthas_VmTool_mallocTrim0
213
+ JNIEXPORT jint JNICALL Java_arthas_VmTool_mallocTrim0
214
214
(JNIEnv *env, jclass thisClass) {
215
215
#ifdef __GLIBC__
216
- if (!::malloc_trim (0 )) {
217
- return JNI_FALSE;
218
- }
216
+ return ::malloc_trim (0 );
219
217
#endif
220
- return JNI_TRUE ;
218
+ return - 1 ;
221
219
}
Original file line number Diff line number Diff line change @@ -241,9 +241,10 @@ public void process(final CommandProcess process) {
241
241
242
242
return ;
243
243
} else if (VmToolAction .mallocTrim .equals (action )) {
244
- boolean result = vmToolInstance ().mallocTrim ();
244
+ int result = vmToolInstance ().mallocTrim ();
245
245
process .write ("\n " );
246
- process .end (result ? 0 : -1 , "mallocTrim result: " + result );
246
+ process .end (result == 1 ? 0 : -1 , "mallocTrim result: " +
247
+ (result == 1 ? "true" : (result == 0 ? "false" : "not supported" )));
247
248
return ;
248
249
}
249
250
You can’t perform that action at this time.
0 commit comments