🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #18404

Structures sizes

#18404
From: Hugo A. Fern�ndez Hurtado.
Date: Thu, 25 Jun 1998 00:00
20 lines
1147 bytes
Im implementing a big binary tree.  It can grow up a lot (several
MBytes),  then I have to save temporal files and merge them later.

To know when I have to save a binary tree to disk, I must find out what
is the size of the information (the object into the nodes).  I need
something like a C sizeOf.

Im trying to implement a sizeOf using java.lang.reflect.field, but I
dont know how to get a field from an object:

Object obj;
Field[] fields = obj.getClass().getDeclaredFields();

How can I get a field (fields[i]) from an object (obj)?

If anybody knows how can I implement a sizeOf.  I will apreciate yor
help.

Tanks.
Technical Details
Message-ID: <3592D346.249F8DC2@artinsoft.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,522e61dc21dd0aa8,start
X-Google-Attributes: gidf74b3,public
From: "Hugo A. Fern�ndez Hurtado." <hfernan@artinsoft.com>
Subject: Structures sizes
Date: 1998/06/25
Message-ID: <3592D346.249F8DC2@artinsoft.com>
X-Deja-AN: 366104519
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.language