Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2006

Tip: Looking for answers? Try searching our database.

finding total number of bytes an object takes up

Thread view: 
kvnsmnsn@hotmail.com - 03 Nov 2006 22:49 GMT
Given an object of a Java class, is there some straightforward way to
find out how many bytes of memory it takes up?

In C there exists a <sizeof()> operator, but even if it had a counter-
part in Java (which doesn't appear to be the case) that wouldn't be
exactly what I want because the objects I want to know the sizes of
contain references to objects of other classes, and I need to know the
_total_ bytes taken up by that object, its components, its components'
components, and so on.  Can anybody point me to how I can find this
out?  Any information would be greatly appreciated.

                               ---Kevin Simonson

"You'll never get to heaven, or even to LA,
if you don't believe there's a way."
from _Why Not_
Daniel Dyer - 03 Nov 2006 22:56 GMT
> Given an object of a Java class, is there some straightforward way to
> find out how many bytes of memory it takes up?
[quoted text clipped - 6 lines]
> components, and so on.  Can anybody point me to how I can find this
> out?  Any information would be greatly appreciated.

This is a frequently-asked question and has been covered on here a few  
times in the last month or so.  There was even a JavaWorld link posted by  
Hendrik Maryns today.  If you search the c.l.j.p Google Groups archive for  
'sizeof' you should find something.

Dan.

Signature

Daniel Dyer
http://www.uncommons.org

Arne Vajhøj - 03 Nov 2006 23:11 GMT
> This is a frequently-asked question and has been covered on here a few
> times in the last month or so.  There was even a JavaWorld link posted
> by Hendrik Maryns today.  If you search the c.l.j.p Google Groups
> archive for 'sizeof' you should find something.

The last one started October 25th and the subject
is "Memory Footprint of an Object".

Arne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.