Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » J2EE Interest »

Re: HttpSeesion.removeAttribute does not garbage collect object

Manish Malhotra

2005-06-30

Replies:

The problem of the object maintaned in the EJB tier, is may be the refrence
of these objects are there with the beans and bean instances are pooled and
not destroyed, so these objects also maintained with the bean. But this is
only if the variable are global and not method level.

And second thing is that EJBObject is also been used by the container, which
might have the return type of the business method in the class. So, that
would also be having reference.

These objects after you have used should be garbagely conllected, but the
other guy said that,
it depends on GC of the JVM.

I think this will help to think further.

regards,
Manish

-----Original Message-----
From: A mailing list for Java(tm) 2 Platform, Enterprise Edition
[mailto:J2EE-INTEREST@(protected)
Sent: Thursday, June 30, 2005 7:02 AM
To: J2EE-INTEREST@(protected)
Subject: Re: HttpSeesion.removeAttribute does not garbage collect object


Hi,
When calling the System.gc() method, you only suggest to the JVM to do
garbage collecting. Whether the JVM is going to garbage collect is up to the
JVM itself. As such different JVM implementation might have different ways
of handling garbage collecting.

Cheers,
Frans

On Wed, 29 Jun 2005 15:35:40 +0530, Partha Ranjan Das wrote:
> Hi J2EE Gurus,
>
> We are having a seemingly peculiar problem.
>
> In this case an activeX client makes multiple HTTP calls to a
> servelt in a web server serially. The servlet has a single method
> to handle all these HTTP calls (called "FP calls") . This method
> has many switch-case statements for these FP calls. In the first
> "case" statement, it calls the EJB tier and gets a collection of
> serializeable Value Object (Or Data Transfer Objects) and this
> collection is maintained in the HttpSession by using
> HttpSession.setAttribute("XYZ",object). Now, when the following
> call, made by the same ActiveX client, (in this FP series of calls)
> comes for the next FP call, it uses the collection stored in
> session. The last FP call, after doing business operations, does
> HttpSession.removeAttribute("XYZ"). So at this point, we assume
> that this collection, which was so far bound to key "XYZ", should
> be ready for garbage collection....right?
> Wrong. When we ran JProfiler to find what all objects are there in
> the memory at this point (after calling GC manually using the
> profiler),--- we find that those objects, constituting that
> collection, which is supposed to be garbage collected, are not at
> all garbage collected. What is more ashtonishing is that we find
> half of these objects are lying in the EJB tier and half in the web
> tier. But the servlet responds to all the FP calls and the ActiveX
> displays all the information required. This means that the HTTP
> responses for all the HTTP "FP call" requests have been duely and
> fully made.
> Does anybody have any idea why, after calling
> session.removeAttribute also, these objects are not garbage
> collected and also why half of these objects are still lying in the
> EJB tier, even after EJB method has ended and GC is called using
> the profiler? We are not maintaining this collection as a static
> propoerty of any of the classes, either in web or EJB tier. We are
> using WSAD 5.1.
> Thanks in advance,
>
> Regards,
> Partha
>
> ======================================================================
> ===== To unsubscribe, send email to listserv@(protected)
> include in the body of the message "signoff J2EE-INTEREST". For
> general help, send email to listserv@(protected)
> the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@(protected)
of the message "signoff J2EE-INTEREST". For general help, send email to
listserv@(protected)".


http://www.patni.com
World-Wide Partnerships. World-Class Solutions.
_____________________________________________________________________

This e-mail message may contain proprietary, confidential or legally
privileged information for the sole use of the person or entity to
whom this message was originally addressed. Any review, e-transmission
dissemination or other use of or taking of any action in reliance upon
this information by persons or entities other than the intended
recipient is prohibited. If you have received this e-mail in error
kindly delete this e-mail from your records. If it appears that this
mail has been forwarded to you without proper authority, please notify
us immediately at netadmin@(protected).
_____________________________________________________________________

===========================================================================
To unsubscribe, send email to listserv@(protected)
of the message "signoff J2EE-INTEREST". For general help, send email to
listserv@(protected)".

©2008 junlu.com - Jax Systems, LLC, U.S.A.