This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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


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
Saloon Keeper

Joined: Jan 17, 2008
Posts: 2667
    
  31

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: 208
    
    9

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
 
Have you checked out Aspose?
 
subject: Is there any means to check the number of objects created when a java prgram runs.
 
It's not a secret anymore!