This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Performance and the fly likes Is there any means to check the number of objects created when a java prgram runs. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Is there any means to check the number of objects created when a java prgram runs. " Watch "Is there any means to check the number of objects created when a java prgram runs. " New topic
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

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: 2274
    
  28

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: 171
    
    5

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is there any means to check the number of objects created when a java prgram runs.
 
Similar Threads
To validate telnet connectivity in java code
JAVA PUZZLES
books for SCJP
Number of Objects
instance of operator