 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Kulbir Guest
|
Posted: Wed Apr 19, 2006 7:12 am Post subject: sizeof in java! need help |
|
|
Hi friends,
i have one doubt. java does not have sizeof(). so how can i know the
size of the objects in java.
thanks |
|
| Back to top |
|
 |
Thomas Weidenfeller Guest
|
|
| Back to top |
|
 |
Andrew McDonagh Guest
|
Posted: Wed Apr 19, 2006 8:12 am Post subject: Re: sizeof in java! need help |
|
|
Kulbir wrote:
| Quote: | Hi friends,
i have one doubt. java does not have sizeof(). so how can i know the
size of the objects in java.
thanks
already addressed in comp.lang.java.programmer. |
followup set to comp.lang.java.programmer. |
|
| Back to top |
|
 |
Kulbir Guest
|
Posted: Wed Apr 19, 2006 8:12 am Post subject: Re: sizeof in java! need help |
|
|
| yeh i know that but technically reason i behind this. |
|
| Back to top |
|
 |
Ingo R. Homann Guest
|
Posted: Wed Apr 19, 2006 9:12 am Post subject: Re: sizeof in java! need help |
|
|
Hi,
Thomas Weidenfeller wrote:
| Quote: | 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 |
|
| Back to top |
|
 |
Roedy Green Guest
|
Posted: Thu Apr 20, 2006 1:12 am Post subject: Re: sizeof in java! need help |
|
|
On 19 Apr 2006 00:00:07 -0700, "Kulbir" <kb.singh1978 (AT) gmail (DOT) com>
wrote, quoted or indirectly quoted someone who said :
| Quote: | i have one doubt. java does not have sizeof(). so how can i know the
size of the objects in java.
|
since the primitive sizes are standard, and since you can't access
objects as a whole there is no need of a sizeof.
See http://mindprod.com/jgloss/primitive.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|