使用live选项时,jmap是否会强制进行垃圾回收?

使用live选项时,jmap是否会强制进行垃圾回收?,第1张

使用live选项时,jmap是否会强制进行垃圾回收?

为了确定活动性,Java 必须 运行完整的GC,因此可以。


让问题沉睡…如果有人需要更深入地研究,这里就是答案。放心吧。

/hotspot/agent/src/share/vm/services/attachListener.cpp的一部分 来自

openjdk
http://download.java.net/openjdk/jdk7/,

并且您必须接受http://www.gnu.org/licenses/gpl-2.0.html

// Implementation of "inspectheap" command//// Input arguments :-//   arg0: "-live" or "-all"static jint heap_inspection(AttachOperation* op, outputStream* out) {  bool live_objects_only = true;   // default is true to retain the behavior before this change is made  const char* arg0 = op->arg(0);  if (arg0 != NULL && (strlen(arg0) > 0)) {    if (strcmp(arg0, "-all") != 0 && strcmp(arg0, "-live") != 0) {      out->print_cr("Invalid argument to inspectheap operation: %s", arg0);      return JNI_ERR;    }    live_objects_only = strcmp(arg0, "-live") == 0;  }  VM_GC_HeapInspection heapop(out, live_objects_only , true );  VMThread::execute(&heapop);  return JNI_OK;}

在vmGCOperations.hpp中,这是定义

`VM_GC_HeapInspection(outputStream* out, bool request_full_gc,        bool need_prologue) :`


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5488098.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-12
下一篇2022-12-12

发表评论

登录后才能评论

评论列表(0条)

    保存