I'm afraid I cannot provide the template due to access restrictions outside the
company. Moreover I'm not sure on what template is causing the OOME because I
have several in the same conditions (thousands of lines with dozens of macros).
But maybe it can help you to know the kind of macros I have defined in my
template.
#macro (GenGroup $prefix $This $NObj $Utilities $Existents $Elements $Generic
$Layouts)
#set($lControl = "${NObj.GetName('Source', 'Header', '')}")
#set ($Level = 0)
#foreach($Elem in ${Elements})
#* *##if (!${Elem.IsOk})
#* *##set($lName = "${This.GetElementName(${Elem.Id})}${prefix}")
#* *##set($Generic = "${Generic}#GenHeaderGroup(${prefix}
${lName})")
#* *##set($Layouts = "${Layouts}#GenLayoutGroup(${prefix}
${lName})")
this.${lName} = new Object.${lControl}();
#* *##RecursiveGenNews ($prefix $Elem $This $NObj $Utilities
$Existents $Generic $Layouts $Level)
#* *##else
#* *##GenNewsForGroup(${Elem} ${prefix} ${NObj} ${Utilities}
${Existents} ${lControl})
#* *##end
#end
#end
As you can see, this macro is calling other macros that are defined in the same
template. And because it is done for each element in a collection
(#foreach($Elem in ${Elements})) it can be called thousands of times (one for
each element).
It would be of great help if you have any information about the limits of
Velocity in processing the templates (heap size, recursive callings...)
-----Mensaje original-----
De: Christopher Schultz [mailto:[EMAIL PROTECTED]
Enviado el: martes, 15 de abril de 2008 16:28
Para: Velocity Developers List
Asunto: Re: Out of memory when calling macros from other macros
Marta,
Marta Gascó Julio wrote:
> I have a template using a large number of macros (35). The macros in
> this template are calling ones to others in different order and
> several times, depending on the code I want to obtain.
>
> My problem is about memory. It seems that when a certain number of
> calls among macros is done an out of memory error appears.
>
> Do any of you know if there are any limit to the number of macros
> that can be called from a template?
Could you provide an example of the template code you are using? It
doesn't necessarily have to reproduce an OOME (because those are very
sensitive to lots of conditions), but at least we could see the types of
nesting, etc. you are attempting.
If you are lucky enough to get a stack trace with your OOME, could you
post it?
Thanks,
-chris
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]