|
|
| finding total number of bytes an object takes up |
|
| Author |
Message |
kvnsmnsn

|
Posted: 11/4/2006 5:49:00 AM |
Top |
java-programmer, finding total number of bytes an object takes up
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

|
Posted: 11/4/2006 5:57:00 AM |
Top |
java-programmer >> finding total number of bytes an object takes up
On Fri, 03 Nov 2006 21:49:26 -0000, <email***@***.com> wrote:
> 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.
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.
--
Daniel Dyer
http://www.uncommons.org
|
| |
|
| |
 |
QXJuZSBWYWpow7hq

|
Posted: 11/4/2006 6:11:00 AM |
Top |
java-programmer >> finding total number of bytes an object takes up
Daniel Dyer wrote:
> 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
|
| |
|
| |
 |
| |
|