• Post Reply Bookmark Topic Watch Topic
  • New Topic

calculate heap info  RSS feed

 
jason chan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello..I have this code to calculate the heap info..
but i need to make this code work when JVM starts..
which means that this code has to start itself when JVM starts and then calculate the heap info at that time
can anyone help me out with this
thanks


 
Campbell Ritchie
Marshal
Posts: 56529
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That makes for confusing code, using Runtime and RunTime classes.

How about putting that code in a static initialiser block in your class with the main method in? It will then be executed when that class is loaded.
 
jason chan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the reply..
i am sorry was a not clear with my problem..
Well what i am looking for is that when JVM starts, a java component should attach itself to the JVM and calculate the heap info automatically..
 
W Fay
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like you want some kind of JVM agent...
 
jason chan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.. Can anyone tell me if i can run this code for multiple JVM's
currently it is for one JVM..but what if there are multiple JVM's in a single box..
I am looking for a multi JVM support...
thanks
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!