`
ordinary
  • 浏览: 79447 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

jstack 和jmap

    博客分类:
  • java
阅读更多

        sun提供的jvm检测工具jstack和jmsp,简单介绍:

 

          jstack命令行工具连接到指定的进程或核心文件,并打印所有连接到虚拟机的线程的堆栈跟踪信息,包括Java 线程和VM 内部线程,有时也包括本地堆栈框架。该工具还执行死锁检测。

用法:jstack [option] pid
参数(Options): 
         -F 在-l 不起作用时,强制打印
         -l 打印堆栈信息
        -m 混合模式打印(可打印c++和java的堆栈信息)
         -h 打印帮助信息
         -help 打印帮助信息
jstack -l 3805
2011-04-23 20:10:57
Full thread dump OpenJDK Client VM (19.0-b09 mixed mode, sharing):

"Process monitor" daemon prio=10 tid=0xad56e400 nid=0x1f52 in Object.wait() [0xac0ad000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.lang.Object.wait(Object.java:502)
	at java.lang.UNIXProcess.waitFor(UNIXProcess.java:181)
	- locked <0x644ddec8> (a java.lang.UNIXProcess)
	at org.eclipse.debug.core.model.RuntimeProcess$ProcessMonitorThread.run(RuntimeProcess.java:417)

   Locked ownable synchronizers:
	- None

"Input Stream Monitor" daemon prio=10 tid=0xad56d800 nid=0x1f51 in Object.wait() [0xad3f7000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.lang.Object.wait(Object.java:502)
	at org.eclipse.debug.internal.core.InputStreamMonitor.writeNext(InputStreamMonitor.java:154)
	- locked <0x64520c28> (a java.lang.Object)
	at org.eclipse.debug.internal.core.InputStreamMonitor.write(InputStreamMonitor.java:124)
	at org.eclipse.debug.internal.core.InputStreamMonitor$1.run(InputStreamMonitor.java:99)
	at java.lang.Thread.run(Thread.java:636)

   Locked ownable synchronizers:
	- None

"Output Stream Monitor" daemon prio=10 tid=0xabda1400 nid=0x1f50 runnable [0xac38b000]
   java.lang.Thread.State: RUNNABLE
	at java.io.FileInputStream.readBytes(Native Method)
	at java.io.FileInputStream.read(FileInputStream.java:236)
	at java.io.BufferedInputStream.read1(BufferedInputStream.java:273)
	at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
	- locked <0x6451eb48> (a java.io.BufferedInputStream)
	at java.io.FilterInputStream.read(FilterInputStream.java:107)
	at org.eclipse.debug.internal.core.OutputStreamMonitor.read(OutputStreamMonitor.java:144)
	at org.eclipse.debug.internal.core.OutputStreamMonitor.access$1(OutputStreamMonitor.java:134)
	at org.eclipse.debug.internal.core.OutputStreamMonitor$1.run(OutputStreamMonitor.java:207)
	at java.lang.Thread.run(Thread.java:636)

   Locked ownable synchronizers:
	- None

"Output Stream Monitor" daemon prio=10 tid=0xabb8f800 nid=0x1f4f runnable [0xad355000]
   java.lang.Thread.State: RUNNABLE
	at java.io.FileInputStream.readBytes(Native Method)
	at java.io.FileInputStream.read(FileInputStream.java:236)
	at java.io.BufferedInputStream.read1(BufferedInputStream.java:273)
	at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
	- locked <0x644e7128> (a java.io.BufferedInputStream)
	at java.io.BufferedInputStream.read1(BufferedInputStream.java:273)
	at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
	- locked <0x6451caa0> (a java.io.BufferedInputStream)
	at java.io.FilterInputStream.read(FilterInputStream.java:107)
	at org.eclipse.debug.internal.core.OutputStreamMonitor.read(OutputStreamMonitor.java:144)
	at org.eclipse.debug.internal.core.OutputStreamMonitor.access$1(OutputStreamMonitor.java:134)
	at org.eclipse.debug.internal.core.OutputStreamMonitor$1.run(OutputStreamMonitor.java:207)
	at java.lang.Thread.run(Thread.java:636)

   Locked ownable synchronizers:
	- None

"process reaper" daemon prio=10 tid=0xad5da800 nid=0x1f4d runnable [0xac820000]
   java.lang.Thread.State: RUNNABLE
	at java.lang.UNIXProcess.waitForProcessExit(Native Method)
	at java.lang.UNIXProcess.access$900(UNIXProcess.java:36)
	at java.lang.UNIXProcess$1$1.run(UNIXProcess.java:148)

   Locked ownable synchronizers:
	- None

"Timer-186" daemon prio=10 tid=0x08311400 nid=0x1f4a in Object.wait() [0xac2a0000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.util.TimerThread.mainLoop(Timer.java:531)
	- locked <0x7310a5b0> (a java.util.TaskQueue)
	at java.util.TimerThread.run(Timer.java:484)

   Locked ownable synchronizers:
	- None

"org.eclipse.jdt.internal.ui.text.JavaReconciler" daemon prio=10 tid=0x0952dc00 nid=0x1f38 in Object.wait() [0xb4a09000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:179)
	- locked <0x7305fe68> (a org.eclipse.jface.text.reconciler.DirtyRegionQueue)

   Locked ownable synchronizers:
	- None

"Attach Listener" daemon prio=10 tid=0xac15b800 nid=0x1e38 waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
	- None

"Java2D Disposer" daemon prio=10 tid=0x08f46000 nid=0x1af9 in Object.wait() [0xad4fe000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:133)
	- locked <0x7296f588> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:149)
	at sun.java2d.Disposer.run(Disposer.java:143)
	at java.lang.Thread.run(Thread.java:636)

   Locked ownable synchronizers:
	- None

"Worker-13" prio=10 tid=0x092d8400 nid=0x1af3 in Object.wait() [0xad684000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at org.eclipse.core.internal.jobs.WorkerPool.sleep(WorkerPool.java:185)
	- locked <0x6e660150> (a org.eclipse.core.internal.jobs.WorkerPool)
	at org.eclipse.core.internal.jobs.WorkerPool.startJob(WorkerPool.java:230)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:50)

   Locked ownable synchronizers:
	- None

"Worker-12" prio=10 tid=0xac158400 nid=0x1af2 in Object.wait() [0xac5fe000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at org.eclipse.core.internal.jobs.WorkerPool.sleep(WorkerPool.java:185)
	- locked <0x6e660150> (a org.eclipse.core.internal.jobs.WorkerPool)
	at org.eclipse.core.internal.jobs.WorkerPool.startJob(WorkerPool.java:230)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:50)

   Locked ownable synchronizers:
	- None

"Thread-23" daemon prio=10 tid=0xad7dbc00 nid=0xf91 in Object.wait() [0xac2f1000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <0x714efc80> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:133)
	- locked <0x714efc80> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:149)
	at org.tmatesoft.svn.core.javahl.SVNClientImplTracker.run(SVNClientImplTracker.java:65)
	at java.lang.Thread.run(Thread.java:636)

   Locked ownable synchronizers:
	- None

"Dali Event Handler" prio=10 tid=0xb4cf7800 nid=0xf85 in Object.wait() [0xb12c6000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.lang.Object.wait(Object.java:502)
	at org.eclipse.jpt.utility.internal.SynchronizedQueue.waitUntilEmptyIs_(SynchronizedQueue.java:138)
	at org.eclipse.jpt.utility.internal.SynchronizedQueue.waitUntilEmptyIs(SynchronizedQueue.java:129)
	- locked <0x70ea3d70> (a org.eclipse.jpt.utility.internal.SynchronizedQueue)
	at org.eclipse.jpt.utility.internal.SynchronizedQueue.waitUntilNotEmpty(SynchronizedQueue.java:153)
	at org.eclipse.jpt.utility.internal.AsynchronousCommandExecutor$Consumer.waitForProducer(AsynchronousCommandExecutor.java:156)
	at org.eclipse.jpt.utility.internal.ConsumerThreadCoordinator$RunnableConsumer.run(ConsumerThreadCoordinator.java:199)
	at java.lang.Thread.run(Thread.java:636)

   Locked ownable synchronizers:
	- None

"Worker-9" prio=10 tid=0x08dd7400 nid=0xf83 in Object.wait() [0xac24f000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at org.eclipse.core.internal.jobs.WorkerPool.sleep(WorkerPool.java:185)
	- locked <0x6e660150> (a org.eclipse.core.internal.jobs.WorkerPool)
	at org.eclipse.core.internal.jobs.WorkerPool.startJob(WorkerPool.java:230)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:50)

   Locked ownable synchronizers:
	- None

"JavaScript indexing" daemon prio=10 tid=0xabb23800 nid=0xf5d in Object.wait() [0xac0fe000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <0x70a9cb40> (a org.eclipse.wst.jsdt.internal.core.search.indexing.IndexManager)
	at java.lang.Object.wait(Object.java:502)
	at org.eclipse.wst.jsdt.internal.core.search.processing.JobManager.run(JobManager.java:370)
	- locked <0x70a9cb40> (a org.eclipse.wst.jsdt.internal.core.search.indexing.IndexManager)
	at java.lang.Thread.run(Thread.java:636)

   Locked ownable synchronizers:
	- None

"com.google.inject.internal.util.$Finalizer" daemon prio=10 tid=0x088e0000 nid=0xf54 in Object.wait() [0xb1525000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <0x6f507b68> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:133)
	- locked <0x6f507b68> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:149)
	at com.google.inject.internal.util.$Finalizer.run(Finalizer.java:144)
	at java.lang.Thread.run(Thread.java:636)

   Locked ownable synchronizers:
	- None

"Timer-0" daemon prio=10 tid=0x085cbc00 nid=0xf44 in Object.wait() [0xac3fe000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.util.TimerThread.mainLoop(Timer.java:531)
	- locked <0x6f316880> (a java.util.TaskQueue)
	at java.util.TimerThread.run(Timer.java:484)

   Locked ownable synchronizers:
	- None

"Worker-5" prio=10 tid=0x08870400 nid=0xf34 waiting on condition [0xb125d000]
   java.lang.Thread.State: WAITING (parking)
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <0x6ef90e68> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
	at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:386)
	at org.eclipse.epp.usagedata.internal.gathering.services.UsageDataService.getQueuedEvent(UsageDataService.java:222)
	at org.eclipse.epp.usagedata.internal.gathering.services.UsageDataService.access$0(UsageDataService.java:220)
	at org.eclipse.epp.usagedata.internal.gathering.services.UsageDataService$1.run(UsageDataService.java:155)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

   Locked ownable synchronizers:
	- None

"Worker-3" prio=10 tid=0x08c6b800 nid=0xf32 in Object.wait() [0xac7ad000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.lang.Object.wait(Object.java:502)
	at org.eclipse.ui.console.IOConsoleInputStream.waitForData(IOConsoleInputStream.java:147)
	at org.eclipse.ui.console.IOConsoleInputStream.read(IOConsoleInputStream.java:92)
	- locked <0x645660a8> (a org.eclipse.ui.console.IOConsoleInputStream)
	at org.eclipse.ui.console.IOConsoleInputStream.read(IOConsoleInputStream.java:117)
	at org.eclipse.debug.internal.ui.views.console.ProcessConsole$InputReadJob.run(ProcessConsole.java:678)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

   Locked ownable synchronizers:
	- None

"Worker-2" prio=10 tid=0x08c50400 nid=0xf31 in Object.wait() [0xb15b3000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at org.eclipse.core.internal.jobs.WorkerPool.sleep(WorkerPool.java:185)
	- locked <0x6e660150> (a org.eclipse.core.internal.jobs.WorkerPool)
	at org.eclipse.core.internal.jobs.WorkerPool.startJob(WorkerPool.java:230)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:50)

   Locked ownable synchronizers:
	- None

"[ThreadPool Manager] - Idle Thread" daemon prio=10 tid=0x087cfc00 nid=0xefd in Object.wait() [0xb1115000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.lang.Object.wait(Object.java:502)
	at org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor.run(Executor.java:106)
	- locked <0x6eee76b0> (a org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor)

   Locked ownable synchronizers:
	- None

"Bundle File Closer" daemon prio=10 tid=0x088fb800 nid=0xefc in Object.wait() [0xb11d6000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.lang.Object.wait(Object.java:502)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.getNextEvent(EventManager.java:397)
	- locked <0x6ee7c6e0> (a org.eclipse.osgi.framework.eventmgr.EventManager$EventThread)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:333)

   Locked ownable synchronizers:
	- None

"Java indexing" daemon prio=10 tid=0x088a8000 nid=0xefb in Object.wait() [0xb1317000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.lang.Object.wait(Object.java:502)
	at org.eclipse.jdt.internal.core.search.processing.JobManager.run(JobManager.java:381)
	- locked <0x6ece1ca0> (a org.eclipse.jdt.internal.core.search.indexing.IndexManager)
	at java.lang.Thread.run(Thread.java:636)

   Locked ownable synchronizers:
	- None

"Worker-JM" prio=10 tid=0xb4cae000 nid=0xef6 in Object.wait() [0xb4967000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at org.eclipse.core.internal.jobs.InternalWorker.run(InternalWorker.java:58)
	- locked <0x6e6602c8> (a java.util.ArrayList)

   Locked ownable synchronizers:
	- None

"[Timer] - Main Queue Handler" daemon prio=10 tid=0xb4c99800 nid=0xef5 in Object.wait() [0xb49b8000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at org.eclipse.equinox.internal.util.impl.tpt.timer.TimerImpl.run(TimerImpl.java:141)
	- locked <0x6e660348> (a java.lang.Object)
	at java.lang.Thread.run(Thread.java:636)

   Locked ownable synchronizers:
	- None

"Framework Event Dispatcher" daemon prio=10 tid=0xb4c84800 nid=0xef3 in Object.wait() [0xb4a5a000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.lang.Object.wait(Object.java:502)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.getNextEvent(EventManager.java:397)
	- locked <0x6e6603b0> (a org.eclipse.osgi.framework.eventmgr.EventManager$EventThread)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:333)

   Locked ownable synchronizers:
	- None

"Start Level Event Dispatcher" daemon prio=10 tid=0x082b0c00 nid=0xef2 in Object.wait() [0xb4aab000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <0x6e5304f8> (a org.eclipse.osgi.framework.eventmgr.EventManager$EventThread)
	at java.lang.Object.wait(Object.java:502)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.getNextEvent(EventManager.java:397)
	- locked <0x6e5304f8> (a org.eclipse.osgi.framework.eventmgr.EventManager$EventThread)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:333)

   Locked ownable synchronizers:
	- None

"State Data Manager" daemon prio=10 tid=0x082f2000 nid=0xef1 waiting on condition [0xb4afc000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
	at java.lang.Thread.sleep(Native Method)
	at org.eclipse.osgi.internal.baseadaptor.StateManager.run(StateManager.java:319)
	at java.lang.Thread.run(Thread.java:636)

   Locked ownable synchronizers:
	- None

"Low Memory Detector" daemon prio=10 tid=0x08274800 nid=0xeef runnable [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
	- None

"CompilerThread0" daemon prio=10 tid=0x08271c00 nid=0xeee waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
	- None

"Signal Dispatcher" daemon prio=10 tid=0x08270400 nid=0xeed runnable [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
	- None

"Finalizer" daemon prio=10 tid=0x0826cc00 nid=0xeec in Object.wait() [0xb4e40000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:133)
	- locked <0x6e360358> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:149)
	at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:177)

   Locked ownable synchronizers:
	- None

"Reference Handler" daemon prio=10 tid=0x08268000 nid=0xeeb in Object.wait() [0xb4e91000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.lang.Object.wait(Object.java:502)
	at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)
	- locked <0x6e360098> (a java.lang.ref.Reference$Lock)

   Locked ownable synchronizers:
	- None

"main" prio=10 tid=0x08239400 nid=0xedd runnable [0xbfc83000]
   java.lang.Thread.State: RUNNABLE
	at org.eclipse.swt.internal.gtk.OS.Call(Native Method)
	at org.eclipse.swt.widgets.Display.sleep(Display.java:4021)
	at org.eclipse.ui.application.WorkbenchAdvisor.eventLoopIdle(WorkbenchAdvisor.java:364)
	at org.eclipse.ui.internal.ide.application.IDEWorkbenchAdvisor.eventLoopIdle(IDEWorkbenchAdvisor.java:887)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2641)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1408)

   Locked ownable synchronizers:
	- None

"VM Thread" prio=10 tid=0x08266400 nid=0xeea runnable 

"VM Periodic Task Thread" prio=10 tid=0x08276c00 nid=0xef0 waiting on condition 

JNI global references: 2009
  
 这种方法可以查看是否存在死锁,当然kill -3 pid也可以的。
    jmap是打印当前线程中,堆中所分配的对象信息,这样可以帮助用户查看哪些对象分配空间大以及该用单例的对象是否变为多例(前端时间就遇到个单例的问题,本来一个ThreadLocal对象应该是单例的,这样每次从对象中就能获得当前线程占用的对象,但是,代码中ThreadLocal对象是多例的,设置的是用的ThreadLocal对象1,获取时却是从ThreadLocal对象2中获取,这个问题查找了一个星期,直到最后才查出原因)
试用方法:
 jmap [ option ] pid
jmap [ option ] executable core
jmap [ option ] [server-id@]remote-hostname-or-IP
参数说明:
option
可选的命令参数
pid
线程id

executable
Java executable from which the core dump was produced.
(可能是产生core dump的java可执行程序)
core
将被打印信息的core dump文件

remote-hostname-or-IP
远程debug服务的主机名或ip

server-id
唯一id,假如一台主机上多个远程debug服务
option 参数描述
-dump:[live,]format=b,file=
输出jvm的heap内容到文件,并使用hprof二进制形式. live子选项如果指定,那么只输出活的对象到文件.
-finalizerinfo
打印正等待回收的对象的信息
-histo[:live]
打印每个class的实例数量,内存占用,类全名信息. VM的内部类名字开头会加上前缀”*”. 假如live子参数加上后,只统计活的对象数量.
-permstat
打印classload和jvm heap持久层的信息. 包括每个classloader的名字,活跃性,地址,父classloader和加载的class数目. 另外,内部String的数量和占用内存数也会打印出来.
-F
强制.在pid没有相应的时候使用-dump或者-histo参数. 在这个模式下,live子参数无效.
-h | -help
打印帮助信息
-J
传递参数给jmap启动的jvm.
 
   看jmap打印的信息 (instances表示实例数)
zhutao@zhutao-ThinkPad-SL:~$ jmap -histo 3805

 num     #instances         #bytes  class name
----------------------------------------------
   1:        460608       43696072  [C
   2:        223150       32302936  <constMethodKlass>
   3:        354365       18073432  <symbolKlass>
   4:        223150       17868632  <methodKlass>
   5:        125718       16314024  [I
   6:         22533       14251960  <constantPoolKlass>
   7:        109146       12854440  [B
   8:         22533       10488912  <instanceKlassKlass>
   9:        391794        9403056  java.lang.String
  10:         18558        8119504  <constantPoolCacheKlass>
  11:        127959        5720464  [Ljava.lang.Object;
  12:        183635        4407240  java.util.HashMap$Entry
  13:         33719        4222864  [Ljava.util.HashMap$Entry;
  14:         93165        2981280  org.apache.xerces.dom.AttrImpl
  15:         33609        2483264  [S
  16:         24171        2320416  java.lang.Class
  17:         41104        1972992  org.apache.xerces.dom.ElementImpl
  18:          5784        1608448  [Lorg.eclipse.ui.views.markers.internal.MarkerType;
  19:         36174        1537464  [[I
  20:         49147        1179528  org.eclipse.equinox.internal.p2.metadata.OSGiVersion
  21:         25175        1007000  java.util.HashMap
  22:         41107         986568  java.util.ArrayList
  23:         30309         969888  java.util.LinkedHashMap$Entry
  24:         40040         960960  java.util.Vector
  25:         35308         847392  org.apache.xerces.dom.AttributeMap
  26:         26437         845984  org.eclipse.equinox.internal.p2.metadata.RequiredCapability
  27:         20354         840960  [Ljava.lang.String;
  28:         35031         840744  java.util.Hashtable$Entry
  29:         34184         820416  java.util.ArrayList$Itr
  30:          8814         809720  [[C
  31:         10126         676048  [Ljava.util.Hashtable$Entry;
  32:         26839         644136  org.eclipse.equinox.internal.p2.metadata.ProvidedCapability
  33:          1638         537264  <objArrayKlassKlass>
  34:         28872         461952  org.eclipse.equinox.internal.p2.metadata.expression.MatchExpression
  35:         10036         401440  java.util.WeakHashMap$Entry
  36:         24684         394944  org.eclipse.jdt.internal.ui.text.spelling.engine.AbstractSpellDictionary$ByteArrayWrapper
  37:          6977         390712  org.jboss.tools.common.meta.impl.XAttributeImpl
  38:          7008         336384  java.util.LinkedHashMap
  39:          4388         315936  java.lang.reflect.Field
  40:          6303         302544  java.util.Properties
  41:         17642         282272  java.lang.Integer
  42:         11230         269520  java.lang.ref.WeakReference
  43:          3329         266320  java.lang.reflect.Method
  44:          4992         239616  org.eclipse.ui.internal.handlers.HandlerActivation
 

 

    接下来简单介绍下jps和jtrace。

分享到:
评论

相关推荐

    JVM性能调优监控工具jps、jstack、jmap、jhat、jstat使用详解.docx

    JVM性能调优监控工具jps、jstack、jmap、jhat、...jps、jstack、jmap、jhat、jstat 等 JVM 性能调优监控工具对于 Java 程序员来说是必备的,能够帮助我们解决各种 JVM 性能问题,提高 Java 应用程序的性能和稳定性。

    通过jstack与jmap分析一次线上故障.pdf

    通过jstack与jmap分析一次线上故障.pdf

    JVM 性能调优监控工具 jps、jstack、jmap、jhat、jstat、hprof 使用详解.zip

    计算机技术、IT咨询、人工智能AI理论介绍,学习参考资料计算机技术、IT咨询、人工智能AI理论介绍,学习参考资料计算机技术、IT咨询、人工智能AI理论介绍,学习参考资料计算机技术、IT咨询、人工智能AI理论介绍,学习...

    Kubernetes应用java程序无法使用jmap,jstack的解决方案.docx

    在 Kubernetes 环境中,运行 Java 程序时,无法使用 jmap 和 jstack 命令进行性能分析和诊断。这种情况下,无法获取 Java 进程的 pid,导致无法使用 jmap 和 jstack 命令。 解决方案: 1. 了解 Linux 特殊进程 在 ...

    细述 Java垃圾回收机制→Java Garbage Collection Monitoring and Analysis1

    它整合了多个Java诊断工具,如JConsole、jstat、jinfo、jstack和jmap等,提供了一系列功能,包括: 1. **生成和分析堆内存的dump**:当应用遇到内存问题时,VisualVM可以生成heap dump文件,通过分析这些文件,...

    异常收集.7z

    为了有效地分析这些异常数据,开发者通常会使用调试工具,如Visual Studio的调试器、Java的JDK自带的jstack和jmap,或者是第三方的日志分析工具。他们将通过对比不同时间点的系统状态,检查代码逻辑,以及查阅相关...

    jvm监控工具

    2. **VisualVM**: VisualVM(也称为jvisualvm)是另一个强大的多合一JVM诊断工具,它整合了JConsole、JProfiler、JStack和JMap的功能。VisualVM可以分析CPU和内存使用情况,监视线程,查看类加载情况,并且可以对...

    Java并发编程实战(中文版).7z

    8. **并发编程的调试和监控**:介绍了如何使用JDK自带的工具,如jconsole、jstack和jmap等,来诊断和优化并发程序。 通过阅读《Java并发编程实战》,读者不仅可以掌握Java并发编程的基础知识,还能学习到如何在实际...

    基于Apache Tomcat的一站式Java应用服务器解决方案.zip

    5. **故障排查**:通过日志文件定位问题,使用JMX(Java Management Extensions)进行远程监控,或者使用工具如jstack和jmap进行内存分析。 此外,你还需要了解Java EE的相关概念,比如EJB(Enterprise JavaBeans)...

    jmap、jstack、jstat组合使用定位jvm问题.txt

    jmap、jstack、jstat组合使用定位jvm问题

    jdk1.6.0_45-zjt.zip

    8. **改进的Javadoc和JVM诊断**:Javadoc生成工具有了更好的HTML5支持,JVM诊断工具如jstack和jmap也变得更加实用。 9. **安全性增强**:加强了加密算法,改进了证书管理和安全套接层(SSL)协议,提升了网络安全。...

    HCNP-Big Data-Developer教材

    文档提到了使用JDK自带的工具(如jstat、jstack和jmap)来分析卡死、性能和内存问题。这些工具可以帮助开发者定位应用程序中的性能瓶颈和错误。 五、解决方案构建与推荐流程 1. FusionInsight资料体系 教材强调了...

    JVM监控工具介绍jstack_jconsole_jinfo_jmap_jdb_jstat

    本文将介绍五种JVM监控工具:jstack、jconsole、jinfo、jmap和jdb。 jstack jstack是一款命令行工具,用于生成Java应用程序的崩溃dump文件的信息。该工具可以attach到正在运行的Java应用程序中,查看当前运行的...

    JVM监控工具介绍jstack, jconsole, jinfo, jmap, jdb, jstat.doc

    本文将深入探讨六种关键的JVM监控工具——`jstack`, `jconsole`, `jinfo`, `jmap`, `jdb`, `jstat`——它们各自的功能、应用场景及如何帮助开发者和运维人员诊断并解决JVM中的复杂问题。 #### 1. jstack —— Java ...

    visualVM_131

    它囊括的命令行工具包括jstat, JConsole, jstack, jmap 和 jinfo,这些工具与JDK的标准版本是一致的。 可以使用VisualVM生成和分析海量数据、跟踪内存泄漏、监控垃圾回收器、执行内存和CPU分析,同时它还支持在...

    IBM堆内存对象分析工具

    基本上出问题就是 df、free、top,然后依次 使用jstack、jmap,具体问题具体分析。 IBM出的一款堆内存对象分析ha(heap analyser)工具,可以用来分析websphere生成的内存转储phd格式文件。 使用方法 1.下载ha457.jar ...

    dbay-apns-for-java:适用于APNS的高性能Java客户端(Apple Push Notification Service)

    然后,我使用JSTACK和JMAP查找发生了什么事情,即DEADLOCK,这导致Java-APNS不再起作用。 我必须重新启动服务才能恢复它。 这太可怕了。 因此,我决定为APNS开发一个新的Java客户端。 然后dbay-apns4j来了。 我认为...

    java诊断与调优常用命令jmap、jstack、jstat使用实战.pdf

    本文主要介绍了四个Java命令行工具:jps、jmap、jstack和jstat,它们是Java性能分析和故障排查的基础。 1. **jps (Java Process Status)**: 用于查看运行在本地机器上的Java进程ID,这对于其他命令来说是必需的输入...

    《JVM从入门到入魔》笔记.pdf

    3:JVM内存调优:JVM参数【标准参数、-X参数、-XX参数等】+常用命令【jps、jinfo、jstat、jstack、jmap】+常用工具【jconsole、jvisualvm、Arthas、MAT】+性能优化及总结+高并发场景分析+JVM性能优化指南。

Global site tag (gtag.js) - Google Analytics