Re: sizeof in java! need help
- From: "Ingo R. Homann" <ihomann_spam@xxxxxx>
- Date: Wed, 19 Apr 2006 10:14:38 +0200
Hi,
Thomas Weidenfeller wrote:
i have one doubt. java does not have sizeof(). so how can i know the
size of the objects in java.
You don't need it. It's that simple.
Well, the shallow size is quite simple.
But how about the "deep size" - that's nontrivial! (*)
Ciao,
Ingo
(*) It's trivial to write a reflection-based method that gets the deep size, but normally, you do not really want the deep size, but something between the flat size and the deep size (**). And that is *very* non-trivial.
(**) Mostly, you want to know the size of the object itself plus (recursively) the size of the referenced objects that are not (***) referenced by other references. :-)
(***) Except they are referenced by Objects within the same graph.
Pheww - example:
A
/ \
B C
/ | \ \
D | E \
\ | \ /
F G
Now, the "expected" sizes are (as sum of flat size):
A: A+B+C+D+E+F+G
B: B+D+E+F (and not G - or perhaps "sizeof(G)/2"?)
C: C (...)
D: D (...)
E: E (...)
F: F
G: G
Note that this is in no way 'transitive'!
Ciao,
Ingo
.
- References:
- sizeof in java! need help
- From: Kulbir
- Re: sizeof in java! need help
- From: Thomas Weidenfeller
- sizeof in java! need help
- Prev by Date: Re: sizeof in java! need help
- Next by Date: Re: Printing MS Word from a JAVA application in a UNIX server
- Previous by thread: Re: sizeof in java! need help
- Next by thread: Re: sizeof in java! need help
- Index(es):
Relevant Pages
|