AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

sizeof in java! need help

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
Kulbir
Guest





PostPosted: Wed Apr 19, 2006 7:12 am    Post subject: sizeof in java! need help Reply with 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
Back to top
Thomas Weidenfeller
Guest





PostPosted: Wed Apr 19, 2006 8:12 am    Post subject: Re: sizeof in java! need help Reply with quote



Kulbir 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.

/Thomas
--
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
Back to top
Andrew McDonagh
Guest





PostPosted: Wed Apr 19, 2006 8:12 am    Post subject: Re: sizeof in java! need help Reply with quote



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





PostPosted: Wed Apr 19, 2006 8:12 am    Post subject: Re: sizeof in java! need help Reply with quote

yeh i know that but technically reason i behind this.
Back to top
Ingo R. Homann
Guest





PostPosted: Wed Apr 19, 2006 9:12 am    Post subject: Re: sizeof in java! need help Reply with quote

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





PostPosted: Thu Apr 20, 2006 1:12 am    Post subject: Re: sizeof in java! need help Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.