Struts 2 uses freemarker to generate the html for the tags, for example for
the form tag this template is used:

http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/form.ftl?view=markup

I was playing with jrockit also and trying to replicate the problem, but it
is kind of hard :). Do you have any testcase, or a page, something that
could help us replicate the problem? I also posted a note on the freemarker
list on how struts configures freemarker, which is on this class:

http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java?view=markup

On that same package there is an StrutsBeanWrapper which is the wrapper used
with freemarker. (I think you asked about it right? memory failing...it is
kind of late :) )

regards
musachy

On 6/23/07, Ing. Andrea Vettori <[EMAIL PROTECTED]> wrote:


Il giorno 22/giu/07, alle ore 19:20, Musachy Barroso ha scritto:

> Yes, freemarker is used by Struts 2 tags to generate html. We could
> have a
> property for the cache setting, but, does it solve your problem?
> (you said
> it was partially resolved)


Most of the garbage is still there but at least about 400-500 MB
generated from freemarker classes seems not there anymore.
I tried to use jrockit instead of sun jvm since it has a better
memory analyzer but I haven't been able to produce a report yet.


May I ask more on how struts2 is using freemarker ?
How is freemarker used in a code snippet like this :

             <td width="34%" valign="bottom" class="fontNormale"
align="center">
                 <span>
                     <s:form name="RicercaArticoliVisOrdina"
action="RicercaArticoliVis">
                         Ordina per <s:select list="%
{listaOrdinamentoArticoli}" value="${numeri.ordinamento[0]}"
name="ordinamento" onchange="document.RicercaArticoliVisOrdina.submit
()"/>
                         <s:hidden name="idRicerca" value="$
{numeri.idRicerca}"/>
                     </s:form>
                 </span>
             </td>
             <td width="33%" valign="bottom" class="fontNormale"
align="right">
                 <span>
                     <s:form name="RicercaArticoliVisDimPagina"
action="RicercaArticoliVis">
                         Mostra <s:select list="{5, 10, 20, 30}"
value="${numeri.dimPagina}" name="dimPagina"
onchange="document.RicercaArticoliVisDimPagina.submit()"/> prodotti
per pagina
                         <s:hidden name="idRicerca" value="$
{numeri.idRicerca}"/>
                     </s:form>
                 </span>
             </td>

What object are created ?

Thanks










>
> regards
> musachy
>
> On 6/20/07, Ing. Andrea Vettori <[EMAIL PROTECTED]> wrote:
>>
>> I discussed the problem with the freemarker team and I used a
>> suggestion that PARTIALLY resolved.
>>
>> They said :
>>
>> =====
>>
>> You can use the code below to enable the model cache, assuming
>> "myConfiguration" is the reference to your Configuration object:
>>
>> ((BeansWrapper)myConfiguration.getObjectWrapper()).setUseCache(true)
>>
>> and see if it helps you with your GC load levels.
>>
>> =====
>>
>> This actually seems to happen.
>> In struts how can this be done ? I used :
>>
>>
>>          freemarker.template.Configuration fmc =
>> (freemarker.template.Configuration)
>> ServletActionContext.getServletContext().getAttribute
>> (FreemarkerManager.CONFIG_SERVLET_CONTEXT_KEY);
>>          if (fmc != null) {
>>              ((freemarker.ext.beans.BeansWrapper)fmc.getObjectWrapper
>> ()).setUseCache(true);
>>          }
>>
>>
>> but I think there must be a configuration somewhere
>> (struts.properties?).
>>
>>
>> To completely solve my problem I really need to understand the
>> following :
>>
>> How struts uses freemarker ? If i have a jsp page that contains html,
>> jsp tags, struts tags and jsp EL expression, where freemarker is
>> used ?
>> I suppose that it's used ONLY on struts tags...
>>
>> So if my page is composed primarly of jsp EL and jsp tags and a few
>> struts tags can I focus on struts tags only to try to understand why
>> the app is producing garbage ?
>>
>>
>> Thank you
>>
>>
>>
>> Il giorno 19/giu/07, alle ore 12:58, Ing. Andrea Vettori ha scritto:
>>
>> >
>> > Il giorno 19/giu/07, alle ore 12:07, Antonio Petrelli ha scritto:
>> >
>> >> 2007/6/19, Ing. Andrea Vettori <[EMAIL PROTECTED]>:
>> >>>
>> >>> Moreover I'm not using freemaker in my project! It's struts
>> that's
>> >>> using it.
>> >>> My page are all jsps !!
>> >>
>> >>
>> >>
>> >> This is pretty strange... Is FreeMarker servlet declared in your
>> >> web.xml?
>> >
>> > No it's not.
>> >
>> > I think that freemarker classes are used by struts internally for
>> > the themes... I use the simple theme.
>> >
>> > I really can't understand what's producing near 2GB of garbage
>> > every 10 seconds!
>> >
>> >
>> > --
>> > Ing. Andrea Vettori
>> > Consulente per l'Information Technology
>> >
>> >
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>>
>> --
>> Ing. Andrea Vettori
>> Consulente per l'Information Technology
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd

--
Ing. Andrea Vettori
Consulente per l'Information Technology



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Reply via email to