From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7ee10ec601726fbf X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-15 19:01:05 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!news2.rdc2.tx.home.com.POSTED!not-for-mail Sender: minyard@wf-rch.cirr.com Newsgroups: comp.lang.ada Subject: Re: is Ada dying? References: <3BC30674.BA88AAB6@brighton.ac.uk> <9pvv3t$ves$1@news.huji.ac.il> <9q42jo$lu8$1@news1.sunrise.ch> <9q95lm$b4l$1@news.huji.ac.il> <3bca9c74.1660187@news.demon.co.uk> <9qedg903km@drn.newsguy.com> <3bcb08bc.29380186@news.demon.co.uk> <9qffea02r59@drn.newsguy.com> <3BCB6058.80F93F5E@sparc01.ftw.rsc.raytheon.com> Reply-To: minyard@acm.org From: minyard@acm.org Message-ID: X-Newsreader: Gnus v5.7/Emacs 20.7 Date: Tue, 16 Oct 2001 02:01:04 GMT NNTP-Posting-Host: 24.7.109.109 X-Complaints-To: abuse@home.net X-Trace: news2.rdc2.tx.home.com 1003197664 24.7.109.109 (Mon, 15 Oct 2001 19:01:04 PDT) NNTP-Posting-Date: Mon, 15 Oct 2001 19:01:04 PDT Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: archiver1.google.com comp.lang.ada:14623 Date: 2001-10-16T02:01:04+00:00 List-Id: Wes Groleau writes: > minyard@acm.org wrote: > > > > Robert*@ writes: > > > yes. In Java, if you have an empty class it will have a size of 24 bytes. > > > a class which has nothing but an 'int' in it, is 32 bytes. A class with > > > nothing in it but one String reference (null) is 50 bytes. So an > > > object ref byitself uses 26 bytes overhead. > > > > This is implementation and processor dependent. I assume you are > > talking about some specific version of Sun's JVM. I'm also not sure > > The class file format for different JVMs is different? I don't think > so. The class file format has nothing to do with the internal representation of the data. That's one of the major design goals of Java. It obviously can't take less space than the actual data, but that's not the case here. The 24 bytes of overhead (on a 32-bit processor) in a Sun JVM is, I believe: 1) A reference to the object's class 2) A piece of synchronization data 3) A piece of data for finalization None of that need be part of the class data itself. In the newest versions of GCJ, 2) and 3) above are kept in hash tables and not directly in the object. It would be hard to extract 1) from the object; that's why I said the minimum overhead for an object is a single pointer. Plus, the JVM is free to follow whatever packing or organization rules it wants. It can pack the data backwards from declaration, align it any way it likes, keep it in multiple separate pieces of data, or whatever. -Corey