File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

size of an object

 
pradeepta chopra
Ranch Hand
Posts: 137
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do we find out the size of an object?
somewhere i read that the way is to convert into string and note the length.
but i find a string like @1fee6fc???
now wat does the above string represent??
 
Jelle Klap
Bartender
Posts: 1951
7
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a bit more involved than that, I'm affraid.
Take a look at this Javaworld article.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The "@1fee6fc" that you see when you call the toString() method of class Object is the hash code of the object in hexadecimal; it does not have anything to do with the size of the object in memory (or the address of the object, as some people think it is).

There is no easy way to find the size of a Java object in memory.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic