Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

List of Objects in the JVM

 
Sandeep Sanaboyina
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way - through java - to find out the list of Objects that are present in the JVM at a particular point of time.

I know that the profilers can do this job. But, I want to know if we can do it ourselves someway through java.

Any insight on how the profilers work will also be appreciated.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15438
41
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Profilers and debuggers usually use a special API that the JVM provides: JVM TI (Java Virtual Machine Tool Interface).
 
Sandeep Sanaboyina
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Profilers and debuggers user special APIs. Is there any way we can achieve this with just core java programming.

For example, we can monitor the heap usage of the JVM through simple java methods. Is there any similar way to find what all objects exist in the JVM.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15438
41
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, there isn't, as far as I know.
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper Young wrote:No, there isn't, as far as I know.


I've never heard either. Such complicated thing in a so easy way... =/
 
Sandeep Sanaboyina
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jesper,
Can you move this thread to Performance. May be someone else might have ideas.
Thanks.
 
Sriram Naga
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you referring to the use of hprof?

Please have a look at this Sun article.

http://java.sun.com/developer/technicalArticles/Programming/HPROF.html
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65114
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sandeep Sanaboyina wrote:Can you move this thread to Performance.

As this is not a performance question, why would that make sense?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic