You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Wing Yew Poon (JIRA)" <xm...@xml.apache.org> on 2009/10/26 20:18:59 UTC

[jira] Assigned: (XMLBEANS-271) Path leaks objects in by caching paths and queries

     [ https://issues.apache.org/jira/browse/XMLBEANS-271?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wing Yew Poon reassigned XMLBEANS-271:
--------------------------------------

    Assignee: Wing Yew Poon

> Path leaks objects in by caching paths and queries
> --------------------------------------------------
>
>                 Key: XMLBEANS-271
>                 URL: https://issues.apache.org/jira/browse/XMLBEANS-271
>             Project: XMLBeans
>          Issue Type: Bug
>          Components: XPath
>    Affects Versions: Version 1.0.3
>         Environment: WinXP, jdk 1.4.2_05
>            Reporter: Scott L'Hommedieu
>            Assignee: Wing Yew Poon
>
> In org.apache.xmlbeans.impl.store.Path
> Several HashMaps are used to cache paths and queries:
> private static Map _xqrlPathCache = new HashMap();
> private static Map _xbeanPathCache = new HashMap();
> private static Map _xqrlQueryCache = new HashMap();
> These caches are then used to store paths and queries as the queries are performed.
> This cache is not managed so as the number of unique queries grows so does the cache.
> Because the cache is not internally managed by xmlbeans the user should be allowed to set some limit to the cache size to prevent an over utilization of memory.
> Below is a snippet of code to illustrate my idea of a sized cache.
> private static HashMap _xqrlPathCache = new CacheMap();
> private static HashMap _xbeanPathCache = new CacheMap();
> private static HashMap _xqrlQueryCache = new CacheMap();
>  
> private static class CacheMap extends LinkedHashMap
> {
>     private static final String XPATH_CACHE_SIZE = "xpathCacheSize";
>     private static int MAX_ENTRIES = -1;
>     static{
>         String size = null;
>         if((size = System.getProperty(XPATH_CACHE_SIZE)) != null){
>             try{
>                 MAX_ENTRIES = Integer.parseInt(size);
>            }catch(Exception e)
>             {   //There's no other logging in here otherwise I would spit out a message
>             }
>         }
>     }

-- 
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: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org