You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Bobby Lawrence <ro...@jlab.org> on 2005/06/02 22:35:53 UTC

Re: ReferenceMap$Entry keeps growing over period of application usage

Skrikanth -
I have also noticed some unexpected memory growth when using OJB.
I have a couple questions...
What profiler did you use?
Also - I guess you built your own OJB jar file and replaced the code in 
the AnonymousPersistentField.java to wrap and un-wrap your object when 
getting it from and putting it into the cache.  What is this 
"WeakReference" class that you used?  It doesn't seem to be part of the 
core OJB distribution...
--Bobby


Srikanth R wrote:

>We are using OJB - 1.0.3 (PB API) in one of our application which is very
>much database intensive. When we put the application under load testing, the
>memory kept on growing and at one stage, the application became very slow as
>there was hardly any memory left on the machine. We were forced to re-start
>the app server.
>
>On putting the application under a profiler, we observed that, the
>"ReferenceMap$Entry" kept on growing in size. Also we saw some of our
>application specific objects in memory as it was not released to the garbage
>collector. We changed the "AnonymousPersistentField.java", to wrap the value
>as a weak reference. The code snippet is given below:
>
>protected void putToFieldCache(Object key, Object value)
>{
>...
>fkCache.put(key, new WeakReference(value));
>...
>}
>Similarly the "getFromFieldCache" is changed to un-wrap the value.
>Ideally the memory should come down to the original value after each
>transaction.
>
>After doing these changes, we found NO references to our application
>specific objects in the memory but still "ReferenceMap$Entry" kept growing
>in size.
>
>Let me know if the fix is a correct one and how to clear of
>"ReferenceMap$Entry".
>
>We are using "org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl" as the
>caching implemetation and the broker is closed at the end of the
>transaction.
>
>Thanks,
>Sriki
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>  
>

-- 
----------------------------
Bobby Lawrence
MIS Application Developer

Jefferson Lab (www.jlab.org)

 Email: robertl@jlab.org
Office: (757) 269-5818
 Pager: (757) 584-5818
----------------------------





---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


RE: ReferenceMap$Entry keeps growing over period of application usage

Posted by Srikanth R <sr...@trigent.com>.
Bobby,

Thanks for the response.

To answer your questions:
 - We are using JProfiler
 - The weak reference class i used is "java.lang.ref.WeakReference".

--Sriki

-----Original Message-----
From: Bobby Lawrence [mailto:robertl@jlab.org]
Sent: Friday, June 03, 2005 2:06 AM
To: OJB Users List
Subject: Re: ReferenceMap$Entry keeps growing over period of application
usage


Skrikanth -
I have also noticed some unexpected memory growth when using OJB.
I have a couple questions...
What profiler did you use?
Also - I guess you built your own OJB jar file and replaced the code in
the AnonymousPersistentField.java to wrap and un-wrap your object when
getting it from and putting it into the cache.  What is this
"WeakReference" class that you used?  It doesn't seem to be part of the
core OJB distribution...
--Bobby


Srikanth R wrote:

>We are using OJB - 1.0.3 (PB API) in one of our application which is very
>much database intensive. When we put the application under load testing,
the
>memory kept on growing and at one stage, the application became very slow
as
>there was hardly any memory left on the machine. We were forced to re-start
>the app server.
>
>On putting the application under a profiler, we observed that, the
>"ReferenceMap$Entry" kept on growing in size. Also we saw some of our
>application specific objects in memory as it was not released to the
garbage
>collector. We changed the "AnonymousPersistentField.java", to wrap the
value
>as a weak reference. The code snippet is given below:
>
>protected void putToFieldCache(Object key, Object value)
>{
>...
>fkCache.put(key, new WeakReference(value));
>...
>}
>Similarly the "getFromFieldCache" is changed to un-wrap the value.
>Ideally the memory should come down to the original value after each
>transaction.
>
>After doing these changes, we found NO references to our application
>specific objects in the memory but still "ReferenceMap$Entry" kept growing
>in size.
>
>Let me know if the fix is a correct one and how to clear of
>"ReferenceMap$Entry".
>
>We are using "org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl" as the
>caching implemetation and the broker is closed at the end of the
>transaction.
>
>Thanks,
>Sriki
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>

--
----------------------------
Bobby Lawrence
MIS Application Developer

Jefferson Lab (www.jlab.org)

 Email: robertl@jlab.org
Office: (757) 269-5818
 Pager: (757) 584-5818
----------------------------





---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org