How can one send a Ctrl-Break to a running Linux p

2019-04-21 09:49发布

I am debugging a memory leak in an application running on Sun's JDK 1.4.2_18. It appears that this version supports the command line param -XX:+HeapDumpOnCtrlBreak which supposedly causes the JVM to dump heap when it encounters a control-break. How does one send this to a background process on a Linux box? It appears that kill signals are the way this ought to work, but I kill -l doesn't report anything that is obviously a Ctrl-Break, at least on my Ubuntu box.

Update: I tested Kill -3 with Sun JDK 1.4.2_18 (_14 was the first to dump heap this way), and it worked. A heap dump file was created, and the process was still running.

2条回答
乱世女痞
2楼-- · 2019-04-21 09:54

Ctrl-\ is the UNIX/Linux equivalent of Windows Ctrl-Break. Wikipedia also tells me that you can also use Ctrl-4 or SysRq on the Linux virtual console (I guess you'd need something weird for a normal terminal emulator to pass representations of those key presses (over ssh/telnet)).

查看更多
Root(大扎)
3楼-- · 2019-04-21 09:55

kill -QUIT might do it (it will generate a thread dump which is generated by ctrl-break on windows. I haven't tried it with the heap dump option though).

查看更多
登录 后发表回答