xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: Wolfgang Hoschek <whoschek AT lbl.gov>
- To: norwoods <norwoods AT gbronline.com>
- Cc: xom-interest AT lists.ibiblio.org
- Subject: Re: [XOM-interest] QName flyweights
- Date: Thu, 9 Jun 2005 13:13:16 -0700
what is the garbage collection strategy? the qnames will remain in the hashmap even after all other references have disappeared.
Yep they remain in there, but only the most recently used 256 qnames since the map is bounded. One might better use 128, but in any case it does not appear to be a problem.
This is what I mean:
/**
* Bounded LinkedHashMap with least-recently-used (LRU) eviction policy.
*/
private static final class LRUHashMap extends java.util.LinkedHashMap {
private final int maxEntries;
private LRUHashMap(int maxEntries) {
super(1, 0.75f, true);
this.maxEntries = maxEntries;
}
protected boolean removeEldestEntry(Map.Entry eldest) {
return size() > maxEntries;
}
}
IMO, there's no need for weak or soft reference complications here since we're just talking a small number of entries here (256 or 128).
Wolfgang.
-
[XOM-interest] QName flyweights,
Wolfgang Hoschek, 06/09/2005
- Re: [XOM-interest] QName flyweights, Elliotte Harold, 06/09/2005
-
Re: [XOM-interest] QName flyweights,
norwoods, 06/09/2005
-
Re: [XOM-interest] QName flyweights,
Wolfgang Hoschek, 06/09/2005
- Re: [XOM-interest] QName flyweights, Wolfgang Hoschek, 06/09/2005
-
Re: [XOM-interest] QName flyweights,
Metalab, 06/09/2005
-
Re: [XOM-interest] QName flyweights,
Mik Lernout, 06/10/2005
-
Re: [XOM-interest] QName flyweights,
Wolfgang Hoschek, 06/10/2005
-
Re: [XOM-interest] QName flyweights,
Wolfgang Hoschek, 06/10/2005
- Re: [XOM-interest] QName flyweights, norwoods, 06/13/2005
- Re: [XOM-interest] QName flyweights, norwoods, 06/13/2005
- Re: [XOM-interest] QName flyweights, Wolfgang Hoschek, 06/13/2005
- Message not available
- Re: [XOM-interest] QName flyweights, Wolfgang Hoschek, 06/13/2005
-
Re: [XOM-interest] QName flyweights,
Wolfgang Hoschek, 06/10/2005
-
Re: [XOM-interest] QName flyweights,
Wolfgang Hoschek, 06/10/2005
-
Re: [XOM-interest] QName flyweights,
Mik Lernout, 06/10/2005
-
Re: [XOM-interest] QName flyweights,
Wolfgang Hoschek, 06/09/2005
- Re: [XOM-interest] QName flyweights, norwoods, 06/10/2005
Archive powered by MHonArc 2.6.24.