FullIdentityMap - memory leak
219855Jan 12 2005 — edited Jan 12 2005I recently changed the cache setting on some reference objects from the default SoftWeakCacheIdentity to FullIdentity. There are a fixed number of these objects and they aren not modified by the application.
After making the change I noticed that the application started sucking up memory and would eventually run out of memory. Switching back the setting to SoftWeakCacheIdentity fixed the problem.
I would like to know if there is something that I am doing incorrectly. Below is a snippet of my object model and how I am using it.
Address (SoftWeakCache - size 100)
---------
BigDecimal id
String street1
String street2
ValuHolderInterface state
State (FullIndentityMap )
--------
BigDecimal id
String code
String description
In the post login event I preload all the state objects by running the following code
public void postLogin(SessionEvent event) {
//Preload all state objects
ReadAllQuery raq = new ReadAllQuery(State.class);
event.getSession().executeQuery(raq);
}
In a bootstap class I save the server session.
server = (ServerSession) SessionManager.getManager().
getSession(sessionName, Thread.currentThread().getContextClassLoader());
In the code that requires the view an address I execute the code
Expression addrExp = new ExpressionBuilder().get("id").equal(23);
ReadObject query = new ReadObjectQuery(Address.class, addrExp);
Address addr = (Address)server.acquireClientSession().executeQuery(query);
System.out.println("State is: " + addr.getState().getDescription());
Thanks..