I had run a jvm process, one day it encountered the outofmemory exception. In the log I have found many outofmemory errors::
-bash-3.00# grep OutOfMemoryError AdminServer.log00399 java.lang.OutOfMemoryError: Java heap space java.lang.OutOfMemoryError: Java heap space java.lang.OutOfMemoryError: Java heap space ####<2013-6-28 05:09:27 pm CST> <Error> <Server> <kfmsapp2> <AdminServer> <DynamicListenThread[Default[3]]> <<WLS Kernel>> <> <>
<1372410567863>
It also generated a heapdump file, I found it was a big object from a thread after analysing by using mat, I just know it's a hibernate common object org.hibernate.engine.PersistenceContext
, but I don't know where it come from.
I want to write a small program, and it will generate a threaddump file automatically when the outofmemory error occured.
My question is: what time of the program executing is best to take a thread dump exactly? Is it on the first outofmemory error appear in the log file?