开发者

Does anyone know an Application to look into a Java Application memory ? Or there is some simple way to create an app to do this kind of stuff ? In C#

开发者 https://www.devze.com 2023-04-02 21:28 出处:网络
I\'ve always seen memory viewers for native windows application, but Java Applications run in the Heap of the Java Virtual machine.

I've always seen memory viewers for native windows application, but Java Applications run in the Heap of the Java Virtual machine.

So how do we look inside the memory of a running Java App, how do we get a look at what goes on the stack.

Is there any application to spy on a Java Application memory Is it possible to write an application to do so ? in Visual C#.

Thank开发者_StackOverflow中文版s for any help.


It is actually possible to look into Java memory via Heap Dumps. Nearly every JVM you will encounter is capable of doing them, and there are programs available to analyze them to. A good place to start writing a program to process heap dumps would probably be to look at the code of one of these programs...

This blog seems to have some information on the subject: http://javaworks.wordpress.com/2009/12/03/jvm-heap-dumps-generation-and-analysis/

Here's Oracle's Java Heap Analysis Tool: http://download.oracle.com/javase/6/docs/technotes/tools/share/jhat.html

Edit: FYI, Not much can be assumed to go on the stack. Primitives are presumably allocated there (considering the lack of new), but objects are always allocated on the heap. An arguable exception would be the Java HotSpot VM, which I have heard does allocate some objects on the stack to improve performance. I think you probably meant heap. ^__^

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号