http://jakarta.apache.org/velocity/developer-guide.html#Velocity%20Configuration%20Keys%20and%20Values

Look at the "<name>.resource.loader.cache" configuration parameter
under the "Resource Management" section.

Rajesh Bahtia <[EMAIL PROTECTED]> writes:

> Daniel
> I am not aware of the cache parameter you mention.Can u elaborate?
> Thanx For Replying
> rajesh
>
>
> -----Original Message-----
> From: Daniel Rall [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 02, 2002 1:48 PM
> To: Rajesh Bahtia; Velocity Developers List
> Subject: Re: Anakia Memory Leak error in velocity version 1.2
>
>
> Rajesh Bahtia <[EMAIL PROTECTED]> writes:
>
>> When we have a very large build.xml that has many AnakiaTask tags , the
>> Anakia throws an Out Of Memory exception.When we profiled to determine the
>> cause we saw that the velocity engine member variable (ve) in
>> AnakiaTask.java was been created everytime and it had instances to the DOM
>> document which resulted in the lots of memory been utilised and ultimately
>> caused the "Out Of Memory" error.
>>
>> My colleague Mitch Christensen (Principal Architecht) has fixed the
> execute
> > function to make the variable ready for garbage collection and this has
>> impoved the performance tremendoulsy.and no longer we the "Out Of Memory"
>> error.
>>
>> I am including the code here and hope that in gets incorporated into the
>> velocity version 1.3.
>
> Not sure if this was addressed.  Are you running with caching turned
> on?  If so, turning it off ought to obviate the need for this patch.
>
> Here's a diff showing the changes against CVS HEAD:
>
> ---
> /home/dlr/src/velocity/src/java/org/apache/velocity/anakia/AnakiaTask.java
> Mon Nov 12 13:38:09 2001
> +++ /home/dlr/AnakiaTask.java Tue Apr  2 13:41:38 2002
> @@ -94,7 +94,7 @@
>   *   
>   * @author <a href="mailto:[EMAIL PROTECTED]";>Jon S. Stevens</a>
>   * @author <a href="mailto:[EMAIL PROTECTED]";>Attila Szegedi</a>
> - * @version $Id: AnakiaTask.java,v 1.33 2001/11/09 00:12:56 geirm Exp $
> + * @version $Id: AnakiaTask.java,v 1.1.1.1 2002/03/23 17:45:49 mchriste Exp
> $
>   */
>  public class AnakiaTask extends MatchingTask
>  {
> @@ -246,6 +246,9 @@
>          String[]         list;
>          String[]         dirs;
>  
> +     if(ve == null)
> +         ve = new VelocityEngine() ;
> +
>          if (baseDir == null)
>          {
>              baseDir = project.resolveFile(".");
> @@ -332,6 +335,9 @@
>          {
>              process( baseDir, list[i], destDir, projectDocument );
>          }
> +
> +     // allow GC of the Velocity Engine
> +     ve = null ;
>      }    
>      
>      /**
> @@ -391,6 +397,7 @@
>                  context.put ("xpath", new XPathTool() );
>                  context.put ("escape", new Escape() );
>                  context.put ("date", new java.util.Date() );
> +                context.put ("xmlFilePath", xmlFile );
>  
>                  // only put this into the context if it exists.
>                  if (projectDocument != null)
> @@ -413,9 +420,9 @@
>          catch (JDOMException e)
>          {
>              if (outFile != null ) outFile.delete();
> -            if (e.getCause() != null)
> +            if (e.getRootCause() != null)
>              {
> -                Throwable rootCause = e.getCause();
> +                Throwable rootCause = e.getRootCause();
>                  if (rootCause instanceof SAXParseException)
>                  {
>                      System.out.println("");
> @@ -507,3 +514,4 @@
>          }
>      }
>  }    
> +
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

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

Reply via email to