Author
Is there any means to check the number of objects created when a java prgram runs.
Vinoth Maharaj
Greenhorn
Joined: Oct 19, 2011
Posts: 3
posted Oct 19, 2011 12:32:33
0
I need to check the number of objects created by this java program.
class Test{
public static void main(String args[]){
System.out.println("Hello World !");
}
}
Never try to win others, win yourself.
Jayesh A Lalwani
Bartender
Joined: Jan 17, 2008
Posts: 1275
You can use any profiler. I believe VisualVM can show you the objects. Or if you don't want to download anything, you can use JMXConsole to take a heap dump
Tina Smith
Ranch Hand
Joined: Jul 21, 2011
Posts: 152
Doesn't VisualVM come with the JDK?
Everything is theoretically impossible, until it is done. ~Robert A. Heinlein
Alfred Peterson
Greenhorn
Joined: Aug 17, 2010
Posts: 12
I have been used VisualVM but not for counting number of objects. I think, you can use it.
emule
Ove Lindström
Ranch Hand
Joined: Mar 10, 2008
Posts: 326
The question has been answered before.
http://www.coderanch.com/t/329407/java/java/find-all-loaded-classes-classloaders
subject: Is there any means to check the number of objects created when a java prgram runs.