You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Henning P. Schmiedehausen" <hp...@intermeta.de> on 2003/07/23 17:22:32 UTC

Patch for Texen

This patch against velocity 1.3.1 made all the differences for me in
running a texen (torque) task which needed > 300 Megabytes (!)  of
memory. With this patch, its memory usage is constant around 10.

There seems to be a resource leak in the ClassPathLoader which is
exposed when using the Data-SQL task from Torque which loads lots and
lots of very small templates again and again.

The first part of the patch makes all the difference. The second part
is just because the templates won't change on the class path for a long
time.

Please apply, this really saved my day.

	Regards
		Henning


RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/texen/ant/TexenTask.java,v
retrieving revision 1.37
diff -u -b -r1.37 TexenTask.java
--- src/java/org/apache/velocity/texen/ant/TexenTask.java       6 Dec 2001 07:46:47 -0000       1.37
+++ src/java/org/apache/velocity/texen/ant/TexenTask.java       23 Jul 2003 15:18:51 -0000
@@ -442,11 +442,11 @@
 
                 Velocity.setProperty(
                     "classpath." + Velocity.RESOURCE_LOADER + 
-                        ".cache", "false");
+                        ".cache", "true");
 
                 Velocity.setProperty(
                     "classpath." + Velocity.RESOURCE_LOADER + 
-                        ".modificationCheckInterval", "2");
+                        ".modificationCheckInterval", "2000");
             }
             
             Velocity.init();

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

Java, perl, Solaris, Linux, xSP Consulting, Web Services 
freelance consultant -- Jakarta Turbine Development  -- hero for hire

--- Quote of the week: "It is pointless to tell people anything when
you know that they won't process the message." --- Jonathan Revusky

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Patch for Texen

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On Sunday, October 26, 2003, at 09:01 AM, Henning Schmiedehausen wrote:

> Hi,
>
> I was worrying about the Resource Leak much more but as I currently
> don't have much time to dig into it, the caching simply hides the
> problem from my application. However, some investigation why the
> Resource Loader starts to leak memory would be useful.

I guess the question is is it leaking, or accumulating?  Dan just 
changed the default impl of the resource cache to be LRU...

geir

>
> 	Regards
> 		Henning
>
>
> On Sun, 2003-10-26 at 12:04, Geir Magnusson Jr. wrote:
>> Done.
>>
>> However, I worry about this because I'm sure that there are different
>> use cases where this matters.  (It clearly does for yours.)  To that
>> end, I restored the original settings, but made them settable via
>> parameters.  Does that solve it?
>>
>> geir
>>
>>
>>
>> On Wednesday, July 23, 2003, at 11:22 AM, Henning P. Schmiedehausen
>> wrote:
>>
>>> This patch against velocity 1.3.1 made all the differences for me in
>>> running a texen (torque) task which needed > 300 Megabytes (!)  of
>>> memory. With this patch, its memory usage is constant around 10.
>>>
>>> There seems to be a resource leak in the ClassPathLoader which is
>>> exposed when using the Data-SQL task from Torque which loads lots and
>>> lots of very small templates again and again.
>>>
>>> The first part of the patch makes all the difference. The second part
>>> is just because the templates won't change on the class path for a 
>>> long
>>> time.
>>>
>>> Please apply, this really saved my day.
>>>
>>> 	Regards
>>> 		Henning
>>>
>>>
>>> RCS file:
>>> /home/cvs/jakarta-velocity/src/java/org/apache/velocity/texen/ant/
>>> TexenTask.java,v
>>> retrieving revision 1.37
>>> diff -u -b -r1.37 TexenTask.java
>>> --- src/java/org/apache/velocity/texen/ant/TexenTask.java       6 Dec
>>> 2001 07:46:47 -0000       1.37
>>> +++ src/java/org/apache/velocity/texen/ant/TexenTask.java       23 
>>> Jul
>>> 2003 15:18:51 -0000
>>> @@ -442,11 +442,11 @@
>>>
>>>                  Velocity.setProperty(
>>>                      "classpath." + Velocity.RESOURCE_LOADER +
>>> -                        ".cache", "false");
>>> +                        ".cache", "true");
>>>
>>>                  Velocity.setProperty(
>>>                      "classpath." + Velocity.RESOURCE_LOADER +
>>> -                        ".modificationCheckInterval", "2");
>>> +                        ".modificationCheckInterval", "2000");
>>>              }
>>>
>>>              Velocity.init();
>>>
>>> -- 
>>> Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
>>> hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/
>>>
>>> Java, perl, Solaris, Linux, xSP Consulting, Web Services
>>> freelance consultant -- Jakarta Turbine Development  -- hero for hire
>>>
>>> --- Quote of the week: "It is pointless to tell people anything when
>>> you know that they won't process the message." --- Jonathan Revusky
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: 
>>> velocity-user-help@jakarta.apache.org
>>>
>>>
>
>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geirm@optonline.net


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Patch for Texen

Posted by Henning Schmiedehausen <hp...@intermeta.de>.
Hi,

I was worrying about the Resource Leak much more but as I currently
don't have much time to dig into it, the caching simply hides the
problem from my application. However, some investigation why the
Resource Loader starts to leak memory would be useful.

	Regards
		Henning


On Sun, 2003-10-26 at 12:04, Geir Magnusson Jr. wrote:
> Done.
> 
> However, I worry about this because I'm sure that there are different  
> use cases where this matters.  (It clearly does for yours.)  To that  
> end, I restored the original settings, but made them settable via  
> parameters.  Does that solve it?
> 
> geir
> 
> 
> 
> On Wednesday, July 23, 2003, at 11:22 AM, Henning P. Schmiedehausen  
> wrote:
> 
> > This patch against velocity 1.3.1 made all the differences for me in
> > running a texen (torque) task which needed > 300 Megabytes (!)  of
> > memory. With this patch, its memory usage is constant around 10.
> >
> > There seems to be a resource leak in the ClassPathLoader which is
> > exposed when using the Data-SQL task from Torque which loads lots and
> > lots of very small templates again and again.
> >
> > The first part of the patch makes all the difference. The second part
> > is just because the templates won't change on the class path for a long
> > time.
> >
> > Please apply, this really saved my day.
> >
> > 	Regards
> > 		Henning
> >
> >
> > RCS file:  
> > /home/cvs/jakarta-velocity/src/java/org/apache/velocity/texen/ant/ 
> > TexenTask.java,v
> > retrieving revision 1.37
> > diff -u -b -r1.37 TexenTask.java
> > --- src/java/org/apache/velocity/texen/ant/TexenTask.java       6 Dec  
> > 2001 07:46:47 -0000       1.37
> > +++ src/java/org/apache/velocity/texen/ant/TexenTask.java       23 Jul  
> > 2003 15:18:51 -0000
> > @@ -442,11 +442,11 @@
> >
> >                  Velocity.setProperty(
> >                      "classpath." + Velocity.RESOURCE_LOADER +
> > -                        ".cache", "false");
> > +                        ".cache", "true");
> >
> >                  Velocity.setProperty(
> >                      "classpath." + Velocity.RESOURCE_LOADER +
> > -                        ".modificationCheckInterval", "2");
> > +                        ".modificationCheckInterval", "2000");
> >              }
> >
> >              Velocity.init();
> >
> > -- 
> > Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
> > hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/
> >
> > Java, perl, Solaris, Linux, xSP Consulting, Web Services
> > freelance consultant -- Jakarta Turbine Development  -- hero for hire
> >
> > --- Quote of the week: "It is pointless to tell people anything when
> > you know that they won't process the message." --- Jonathan Revusky
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> >


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Patch for Texen

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Done.

However, I worry about this because I'm sure that there are different  
use cases where this matters.  (It clearly does for yours.)  To that  
end, I restored the original settings, but made them settable via  
parameters.  Does that solve it?

geir



On Wednesday, July 23, 2003, at 11:22 AM, Henning P. Schmiedehausen  
wrote:

> This patch against velocity 1.3.1 made all the differences for me in
> running a texen (torque) task which needed > 300 Megabytes (!)  of
> memory. With this patch, its memory usage is constant around 10.
>
> There seems to be a resource leak in the ClassPathLoader which is
> exposed when using the Data-SQL task from Torque which loads lots and
> lots of very small templates again and again.
>
> The first part of the patch makes all the difference. The second part
> is just because the templates won't change on the class path for a long
> time.
>
> Please apply, this really saved my day.
>
> 	Regards
> 		Henning
>
>
> RCS file:  
> /home/cvs/jakarta-velocity/src/java/org/apache/velocity/texen/ant/ 
> TexenTask.java,v
> retrieving revision 1.37
> diff -u -b -r1.37 TexenTask.java
> --- src/java/org/apache/velocity/texen/ant/TexenTask.java       6 Dec  
> 2001 07:46:47 -0000       1.37
> +++ src/java/org/apache/velocity/texen/ant/TexenTask.java       23 Jul  
> 2003 15:18:51 -0000
> @@ -442,11 +442,11 @@
>
>                  Velocity.setProperty(
>                      "classpath." + Velocity.RESOURCE_LOADER +
> -                        ".cache", "false");
> +                        ".cache", "true");
>
>                  Velocity.setProperty(
>                      "classpath." + Velocity.RESOURCE_LOADER +
> -                        ".modificationCheckInterval", "2");
> +                        ".modificationCheckInterval", "2000");
>              }
>
>              Velocity.init();
>
> -- 
> Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
> hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/
>
> Java, perl, Solaris, Linux, xSP Consulting, Web Services
> freelance consultant -- Jakarta Turbine Development  -- hero for hire
>
> --- Quote of the week: "It is pointless to tell people anything when
> you know that they won't process the message." --- Jonathan Revusky
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geirm@optonline.net


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org