Howdy,
>i've read in a number of locations that you shouldn't put large objects
in
>session, because of the overhead incurred.
>Is this also true for non-serializable objects? Aren't they simply kept
in
>memory?
Not exactly: I wouldn't put non-serializable objects in the session at
all, regardless of their size. You will get errors. Instead, put the
ID (or some other key allowing you to retrieve the object) in the
session.
>In addition does anybody know how I can accurately estimate the memory
>footprint such an object has?
The same way you estimate the memory footprint of any other object.
For example, from a simple command-line program that does nothing else:
int N = 10000;
long freeBefore = Runtime.getRuntime().freeMemory();
MyObject[] myArray = new MyObject[N];
for(int i = 0; i < N; i++) {
myArray[i] = new MyObject();
}
long freeAfter = Runtime.getRuntime().freeMemory();
long delta = freeAfter - freeBefore;
long memPerObject = delta / N;
(Use a large N to reduce impact of overhead, allocation, etc.)
Yoav Shapira
This e-mail, including any attachments, is a confidential business communication, and
may contain information that is confidential, proprietary and/or privileged. This
e-mail is intended only for the individual(s) to whom it is addressed, and may not be
saved, copied, printed, disclosed or used by anyone else. If you are not the(an)
intended recipient, please immediately delete this e-mail from your computer system
and notify the sender. Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]