commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Naveen <nawee...@yahoo.com>
Subject Re: Log4j String buffer memory Leak.
Date Wed, 07 Jun 2006 20:19:23 GMT
Thanks a lot sandy and Oliver ..
  but the issue remains...Mercury Diagnosis tools reports lot of Sting Buffer being created
at that particular method call and never being released. Iam stuck in middle and have no clue
what so ever.
   
  Our company is in process of evaluating Mercury Diagnosis tool and they really want us to
go by the tool reports and make the changes . Iam stuck at this place and not sure what change
to make.

Sandy McArthur <sandymac@apache.org> wrote:
  Naveen,

That sample code will result in a String being passed to debug or
info. The StringBuffer used internally by the compiler will be
available for garbage collection after the StringBuffer is converted
to a String and before the resulting String is passed as a parameter.

There isn't a memory leak there as much as maybe wasted work done in
object creation to create the method parameter. Using the if
(logger.isDebugEnabled()) idiom Oliver suggested will save that work.

I'm not familar with Mercury but if it really reports a leak there
then it's probably false positive.

On 6/7/06, Naveen wrote:
> Hello all,
>
> Iam not sure if there is really amemory leak in Log4jLogger. We use Mercury diagnosis
tool to find the memory leak and the reports show all the string buffers being held up at
>
> 1. org.apache.log4j.Logger.debug
> 2. org.apache.log4j.Logger.info
>
> this is one of the call we make
>
> logger.debug(connectionID + "-" + message);
>
> logger is an instance of Log4j.Logger and connectionID,message are strings
>
> i know appending strings will internally create StrinBuffers but our memory reports show
string buffers are never cleared which are areated during that call.
>
> any help is highly appreciated.
>
> Thanks,
> Naveen.
>
>
>
>
>
>
> Naveen
>
> It only takes a moment to be kind, but the results can be everlasting.!!
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>


-- 
Sandy McArthur

"He who dares not offend cannot be honest."
- Thomas Paine

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




    Naveen 
   
  It only takes a moment to be kind, but the results can be everlasting.!!



 __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message