Ulrich said:
I guess that's a hard question:
There are no hard questions. The answers* are a
different matter.
..How to guess the memory consumption of
a Java object?
I will ask you a question back.
Why? What is the end purpose of the task?
Try and answer that in terms of "I want to offer the
end user X". Where X is something the end user
might actually care about.
So that might include 'protection of crashing
from lack of memory', or 'warning of low memory',
but most users do not care how 'big' any individual
Java object might consume within the memory
space that the Java application is assigned.
From the developer's POV, it is better to not worry
about the memory size of objects unless/until it
becomes a problem, then it would be best to use
a profiler to determine what the problem is.
...
Lets first assume no inheritance and simple data types only. Maybe
there's a number for that.
(shrugs) 37. (* Also note that WAG's and sarcastic
answers are easy.)
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200709/1