Generate java dump when OutOfMemory

前端 未结 3 1118
难免孤独
难免孤独 2021-01-05 05:34

I have a program that should eventually generate OutOfMemory . The program code is:

public class VeryLargeObject implements Serializable {
    p         


        
3条回答
  •  礼貌的吻别
    2021-01-05 06:04

    The problem is that -XX:HeapDumpPath spefies a file and not a path.

    -Xms1024m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="c:\temp\dump2.hprof"
    

    added:

    and bestsss is right too, so you need to fix both "errors":

    java -Xms1024m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="c:\temp\dump2.hprof" VeryLargeObject
    

提交回复
热议问题