doesn't necessarily mean in memory size).
> >
> > Just wait til those slackers at Sun at a Object.sizeof() method in jdk1.9
> or
> >
> > something lame.
> >
> > BAL
> >
> > >From: Navjot Singh <[EMAIL PROTECTED]>
> > >T
c String getID() {
return ID;
}
public void setAge(int age) {
this.age = age;
}
public int getAge() {
return age;
}
}
-Original Message-
From: Erik Weber [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 08, 2004 10:57 PM
To: Struts Users Mailing List
Subject:
ow to calculate the size of an object
Also remember that when you serialize an Object (if I am not mistaken),
all the Objects referred to by that Object get serialized too (unless
the references are transient). In addition, there is serialization
overhead (protocol info that is not actually part of
ect.sizeof() method in jdk1.9 or
>
> something lame.
>
> BAL
>
> >From: Navjot Singh <[EMAIL PROTECTED]>
> >To: Struts Users Mailing List <[EMAIL PROTECTED]>
> >Subject: Re: [OT] how to calculate the size of an object
> >Date: Thu, 08 Jul 2004
ect.sizeof() method in jdk1.9 or
something lame.
BAL
From: Navjot Singh <[EMAIL PROTECTED]>
To: Struts Users Mailing List <[EMAIL PROTECTED]>
Subject: Re: [OT] how to calculate the size of an object
Date: Thu, 08 Jul 2004 22:16:12 +0530
hi,
Thanks for the link but this is very naive way of
Also remember that when you serialize an Object (if I am not mistaken),
all the Objects referred to by that Object get serialized too (unless
the references are transient). In addition, there is serialization
overhead (protocol info that is not actually part of your Object but
that is required
public static long getSize(LDIFData data) {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(baos);
out.writeObject(data);
out.close();
return baos.toByteArray().length;
}
catch (Exception e) {
e.printStackTrace();
return -1;
}
}
John M
ot; <[EMAIL PROTECTED]>
To
Struts Users Mailing List
<[EMAIL PROTECTED]>
cc
Subject
Re: [OT] how to calculate
the size of an object
hi,
Thanks for the link but this is very naive way of doing it. I am leaving
it to the mercy of gc.
What this method is doing
1. run gc
> -Original Message-
> From: Navjot Singh [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 08, 2004 9:46 AM
> To: Struts Users Mailing List
> Subject: Re: [OT] how to calculate the size of an object
>
>
> hi,
>
> Thanks for the link but this is very
hi,
Thanks for the link but this is very naive way of doing it. I am leaving
it to the mercy of gc.
What this method is doing
1. run gc() manually (AND hope it wont run automatically again soon.)
2. free memory
3. create and object.
4. free memory
and now just wish that JVM wont allocate any memo
Whoops.. that should the problem with the first one on the list.. :)
I know Bad code monkey no caffeine.
> -Original Message-
> From: Jim Barrows
> Sent: Thursday, July 08, 2004 9:24 AM
> To: Struts Users Mailing List
> Subject: RE: [OT] how to calculate the si
with a negative number.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 08, 2004 9:10 AM
To: Struts Users Mailing List
Subject: Re: [OT] how to calculate the size of an object
http://www.google.com/search?hl=en&lr=&ie=UTF-8&q=size
http://www.google.com/search?hl=en&lr=&ie=UTF-8&q=size+java+object
The first one looks promising.
Dennis
Navjot Singh <[EMAIL PROTECTED]>
07/08/2004 11:57 AM
Please respond to
"Struts Users Mailing List" <[EMAIL PROTECTED]>
To
Struts Users Mailing List
<[EMAIL PROTECTED]>
cc
java.io.File has the length() method to return the length of the file.
> -Original Message-
> From: Navjot Singh [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 08, 2004 8:58 AM
> To: Struts Users Mailing List
> Subject: [OT] how to calculate the size of an object
>
>
> hi,
>
> I use S
Navjot Singh wrote:
I use SAX parser to load an LDIF file into memory. Whatsoever data i
read, i fill into an object.
I need to know *the size of LDIFData object* at runtime. How to do that?
Well the class structure is something like this
public class LDIFData{
ArrayList cards; // collection of C
15 matches
Mail list logo