[ 
https://issues.apache.org/jira/browse/VELOCITY-715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12772855#action_12772855
 ] 

Will Glass-Husain commented on VELOCITY-715:
--------------------------------------------

Thanks for sharing this.

This isn't a use case I've encountered.  These are all unique file names, 
right?  Your test is assuming hundreds of thousands of different file names.  
Most sites I've seen have a much smaller number of template names.

I'm also concerned about the use of a WeakHashMap.  I'm not super experienced 
with this, but doesn't this remove the key but not the value?  I'm concerned 
this may still leave the reference.

http://www.codeinstructions.com/2008/09/weakhashmap-is-not-cache-understanding.html

> Leaked object in FileResourceLoader#templatePaths
> -------------------------------------------------
>
>                 Key: VELOCITY-715
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-715
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>            Reporter: Atsushi Isobe
>            Priority: Minor
>         Attachments: FileResourceLoader.patch, 
> FileResourceLoaderLeakedObjectTest.java
>
>
>  org.apache.velocity.runtime.resource.loader.FileResourceLoader#templatePaths 
> has stored templatename and real file path permanently.So if 
> VelocityEngine#getTemplate(String) has called by too many files, 
> #templatePaths have been enlarged. 
> Bellow my test results.
> ----------------------------------------
> 2009-05-08 19:16:54,571 INFO  [FileResourceLoaderLeakedObjectTest] count: 
> 000,000 total: 002,696,488
> 2009-05-08 19:19:23,381 INFO  [FileResourceLoaderLeakedObjectTest] count: 
> 065,536 total: 014,689,896
> 2009-05-08 19:22:03,782 INFO  [FileResourceLoaderLeakedObjectTest] count: 
> 131,072 total: 025,374,944
> 2009-05-08 19:24:14,756 INFO  [FileResourceLoaderLeakedObjectTest] count: 
> 196,608 total: 036,282,696
> 2009-05-08 19:26:37,864 INFO  [FileResourceLoaderLeakedObjectTest] count: 
> 262,144 total: 046,776,168
> 2009-05-08 19:28:55,090 INFO  [FileResourceLoaderLeakedObjectTest] count: 
> 327,680 total: 057,119,560
> 2009-05-08 19:31:37,524 INFO  [FileResourceLoaderLeakedObjectTest] count: 
> 393,216 total: 069,858,824
> 2009-05-08 19:34:10,425 INFO  [FileResourceLoaderLeakedObjectTest] count: 
> 458,752 total: 080,019,920
> 2009-05-08 19:36:52,788 INFO  [FileResourceLoaderLeakedObjectTest] count: 
> 524,288 total: 090,093,168
> 2009-05-08 19:39:13,662 INFO  [FileResourceLoaderLeakedObjectTest] count: 
> 589,824 total: 097,385,776
> 2009-05-08 19:41:54,621 INFO  [FileResourceLoaderLeakedObjectTest] count: 
> 655,360 total: 107,387,792
> 2009-05-08 19:44:31,601 INFO  [FileResourceLoaderLeakedObjectTest] count: 
> 720,896 total: 117,451,912
> 2009-05-08 19:47:08,890 INFO  [FileResourceLoaderLeakedObjectTest] count: 
> 786,432 total: 137,151,792
> 2009-05-08 19:49:44,924 INFO  [FileResourceLoaderLeakedObjectTest] count: 
> 851,968 total: 147,277,856

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to