Re: Serizlize You Cannot Use for Object Size
Lasse Reichstein Nielsen wrote:
moleskyca1@yahoo.com writes:
So what is the way to compute the memory consumed by object? This is
hard to work with language that doesn't support this.
No it's not. I have yet to need it for anything in Java.
It all depends on how you think about memory. In C, you need to count
bytes and do pointer arithmetic. You need to know how many bytes you
use, because you are doing memory management manually. In Java, you
don't care about the exact size of an object. You care about how many
objects you create and how long they live, but whether an object has 4
or 8 bytes of overhead is completely irrelevant.
Huh? Here's a specific problem. Suppose I have an application that uses
a lot of memory. The size of a problem can be expressed in terms of a
few parameters. I know the numbers of certain types of objects that will
be created, as functions of those problem size parameters.
For simplicity, let's assume a single basic size parameter N. However,
for real problems there may be more size parameters.
I would like to run a problem with N=10,000. I know, by experiment, that
it does not run on any machine to which I currently have access. If I
ask my academic adviser (or my manager if I were working in industry)
for access to a bigger memory, the inevitable question is "How big?".
How should I go about answering that question, without caring about
object sizes?
Patricia