Well, I don't have an issue with memory leaks now, and it's been a while
since I had some problem with it(but it was due to some references in a list
not cleaned).. It maybe a 'cargo cult', but I don't think it is
harmful,-apart from some overhead- so I just prefer to be on the safe side.

A little OT. If I recall correctly, the GC basically keeps a count of the
references for each object in the JVM. Once the number of refereces is null,
it cleans the object. But let's say we have a circular reference between two
objects, and we clean any references to them. What would happen with those
objects? Will they be cleaned?

JL

2011/8/1 Dave Newton <davelnew...@gmail.com>

> Unless you have proof an action's properties are causing a memory leak, it
> sounds like "cargo cult" programming to me. Most cases if leaks like this
> are caused by something else in the code keeping references.
>
> Have you profiled the app to see if what you want is really necessary? I'm
> pretty skeptical.
>
> Dave
>  On Aug 1, 2011 3:49 AM, "JOSE L MARTINEZ-AVIAL" <jlm...@gmail.com> wrote:
> > Well, the interceptor should be the first one on the stack, so all data
> > required in the result should have been already used. It's not a bad
> idea,
> I
> > will work with that.
> >
> > With respect to the GC, back in 2002 when I started using Java the GC
> didn't
> > work quite well, and my team and I started clearing and setting to null
> any
> > reference that weren't used anymore to avoid issues with memory, and I've
> > doing that since then. In fact, the few times I've had some issues with
> > memory leaks, it was usually due to some variables fields not cleared.
> >
> > 2011/8/1 Maurizio Cucchiara <mcucchi...@apache.org>
> >
> >> Doing what you are looking for through an interceptor is quite
> >> trivial: you should simply check (after the invocation.invoke() call)
> >> if an action implements Destroyable IF and then call the destroy
> >> method.
> >> Anyway, I think that the garbage collector in this specific case is
> >> able to do a good work, why don't you trust it?
> >>
> >> On 1 August 2011 08:44, JOSE L MARTINEZ-AVIAL <jlm...@gmail.com> wrote:
> >> > Hi,
> >> > Is there a way to destroy correctly an Action? I know that a instance
> >> of
> >> > an Action is created every time it is needed, and it is alive during
> the
> >> > processing of the request until the response is sent back to the user.
> >> What
> >> > I don't know is if the instance is 'destroyed' in some way, or Struts
> >> just
> >> > sets to null the references to it, and that's it. I'm used to
> implement
> a
> >> > Destroyable interface in all my classes, which I use to clear any Map,
> >> List,
> >> > etc, and set to null any field in the object, in order to avoid memory
> >> > leaks. I would like to do the same with the action. I know I could
> >> implement
> >> > an Interceptor to do that, but I don't know if this is already covered
> in
> >> > Struts. Any thoughts?
> >> >
> >> > TIA
> >> >
> >> > Jose Luis
> >> >
> >>
> >>
> >>
> >> --
> >> Maurizio Cucchiara
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> >> For additional commands, e-mail: user-h...@struts.apache.org
> >>
> >>
>

Reply via email to