When you store an object reference in the session it prevents that
object from being garbage collected, at least until the session times
out. So practically speaking you are keeping the full amount of memory
around even if it's not literally stored in the session hashtable.

Rod McChesney, Korobra


Sameer Tyagi wrote:
>
> The misconception is that the object IS NOT stored in the session. ITS A
> HANDLE or reference. The actual object is in memory.
> This math that you show is totally incorrect, Its like saying that the
> each charecter in ASCII is 1 byte so if your source file contains 2000
> charecters of source code the compiled class file will be 8*2000 bytes.
> HUHH ??
> The actual object storeage in a session doesnt involve more than a few
> bytes.!~
>
> The same thing happens when you store stuff in a Hashtable, a ref is
> stored NOT the object ~!!! THERE is a BIG
> difference and most C/C++ programmers have difficulty understanding that
> in Java,objects( not in RMI) are passed by reference and primitives by
> values.
>
> I have enclosed a test program for you . That puts
> >java -Xms32M -Xmx32M Mem
>
> This populates the Hashtable with 10000 MyObjects
> As you can see, each object translates into 158.4832 bytes ( not KB)
>
> The actual session memory usage depends on the servers implememntation
> of the HttpSession inteface. weblogic for example uses EJBs to
> internally handle sessions, as compared to the Suns JSWDK.
>
> Hope this helps.
> -Sameer

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to