struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Petrelli (JIRA)" <>
Subject [jira] Commented: (STR-1333) [tiles] excessive memory usage
Date Fri, 08 Jun 2007 19:49:26 GMT


Antonio Petrelli commented on STR-1333:

Just a note: I think that Tiles 2 is not affected because everything is managed through a

> [tiles] excessive memory usage
> ------------------------------
>                 Key: STR-1333
>                 URL:
>             Project: Struts 1
>          Issue Type: Improvement
>          Components: Tiles
>    Affects Versions: 1.1 RC1
>         Environment: Operating System: All
> Platform: All
>            Reporter: Christophe Warland
>            Assignee: Struts Developers
>            Priority: Minor
>             Fix For: Future
>         Attachments: patch-tiles-component-delegation.txt
> The implementation of component definition inheritance in Tiles is based on a
> deep-copy of all attributes in a parent's map. This systematic deep copy is very
> memory consuming and should be replaced by delegation between
> ComponentDefinition instances at runtime.
> My company has updated the copy of Tiles that it uses in production (dated
> 2001-09-11) so that delegation actually occurs at runtime between the 668
> component definitions that we use in our system. This simple change allows us to
> save more than 50 MB of ram. 
> We actually have 7037 attributes defined in XML files. As mentionned above, the
> original Tiles requires more than 50 MB of RAM to load them and store them in
> HashMaps. However, since HashMap entries take only 24 bytes in memory, Tiles
> should in theory only need 7037 * 24 = 165k to load them. This is exactly what
> the proposed change does.
> [More on this can be read in the following thread:
> ]
> In summary, to update Tiles, you should take the following approach:
> 1. go to ComponentDefinition and ComponentContext and delete the following
> dangerous methods
>     public Map getAttributes()
>     public ComponentContext(Map attributes)
>     public void addAll(Map newAttributes)
>     public void addMissing(Map defaultAttributes)
> 2. then refactor/recompile/refactor the rest of Tiles until you have something
> usable (pass along and keep track of ComponentDefinition objects as much as you
> can -- never access the HashMap directly).
> It worked very well for us. Our patch, which is based on Tiles 2001-09-11 is
> attached, to this bug report.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message