You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Per Kreipke <pe...@onclave.com> on 2002/08/13 17:00:30 UTC
[Q] SunRise AuthAction nitpicking...
I see most actions returning empty maps by using either the EMPTY_MAP
constant from the AbstractAction base class or creating their own
unmodifiable map using Collections.
But in AuthAction, the map is returned via:
map = new HashMap();
as does SunRise.createMap()
I'm not a Java expert so I just want to be sure that it's not a memory leak.
I'm sure it gets garbage collected but isn't it cheaper to return a final
static variable (EMPTY_MAP), especially since it happens on every request?
Per
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
RE: [Q] SunRise AuthAction nitpicking...
Posted by Carsten Ziegeler <cz...@s-und-n.de>.
Per Kreipke wrote:
>
> I see most actions returning empty maps by using either the EMPTY_MAP
> constant from the AbstractAction base class or creating their own
> unmodifiable map using Collections.
>
> But in AuthAction, the map is returned via:
>
> map = new HashMap();
>
> as does SunRise.createMap()
>
> I'm not a Java expert so I just want to be sure that it's not a
> memory leak.
> I'm sure it gets garbage collected but isn't it cheaper to return a final
> static variable (EMPTY_MAP), especially since it happens on every request?
>
It's not a memory leak - but it's a "performance killer". Yes, these two
places were overseen. I will fix this asap.
Thanks for spotting these.
Carsten
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>