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

Byron Foster commented on VELOCITY-715:
---------------------------------------

The WeakHashMap will correctly drop the value when the key is gargage 
collected, but as your link points out the WeakHashMap is not a cache.  JVM 
behavior will differ, but in general key/value pairs will be dropped for every 
garbage sweep, which mean allot of rebuilding of templates.  Also, as you point 
out, this is only an issue with many 10s of thousands of file names...  I can't 
imagine a use case where this is a practical concern.

I don't see a bug here..


> 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