[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    [jira] Updated: (XMLBEANS-271) Path leaks objects in by caching
From:       "Scott L'Hommedieu (JIRA)" <xmlbeans-dev () xml ! apache ! org>
Date:       2006-05-23 16:59:36
Message-ID: 14410792.1148403576714.JavaMail.jira () brutus
[Download RAW message or body]

     [ http://issues.apache.org/jira/browse/XMLBEANS-271?page=all ]

Scott L'Hommedieu updated XMLBEANS-271:
---------------------------------------

    Description: 
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  }
        }
    }


  was:
In org.apache.xmlbeans.impl.store.Path

Several HashMaps are used to cache paths and queries:



Oops, premature submit.

> Path leaks objects in by caching paths and queries
> --------------------------------------------------
> 
> Key: XMLBEANS-271
> URL: http://issues.apache.org/jira/browse/XMLBEANS-271
> Project: XMLBeans
> Type: Bug

> Components: XPath
> Versions: Version 1.0.3
> Environment: WinXP, jdk 1.4.2_05
> Reporter: Scott L'Hommedieu

> 
> 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.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic