ok great, thanks for the reply.
And the hash in which you look up the object with the retrieved id can be just something like a static hashtable in some class ?
Greetz Hans
At 09:03 AM 8/6/2003 -0400, Shapira, Yoav wrote:
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]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
