logo       

RE: possible memory leak with syslog feature in log4cxx-0.9.8.tar.gz?: msg#00004

Subject: RE: possible memory leak with syslog feature in log4cxx-0.9.8.tar.gz?
Curt,

Thanks for the response. Your explanation makes sense. I probably need
to play around with it some more to get better understanding of the
memory pool.

Thanks again,
Min

-----Original Message-----
From: Curt Arnold [mailto:carnold@xxxxxxxxxx] 
Sent: Friday, March 31, 2006 9:20 PM
To: Log4CXX User
Subject: Re: possible memory leak with syslog feature in
log4cxx-0.9.8.tar.gz?


On Mar 31, 2006, at 1:19 PM, Min Tjong wrote:

> Hello,
>
>
>
> First of all, I apologize for this rather lengthy email.  I am new  
> to log4cxx and have recently encountered a memory leak issue with  
> log4cxx-0.9.8.tar.gz.  I downloaded it fromhttp:// 
> littletux.homelinux.org/log4cxx and started playing with the syslog  
> feature
>
> by modifying the console example code provided in the package.    
> Basically the configure function is modified to use SyslogAppender  
> and PatternLayout and the main function is modified to include a  
> while loop with a sleep statement between logging occurrences.  The  
> entire modified code is presented below.
>
>
>
> Running the program on Windows XP, I am experiencing a memory leak  
> of approximately 120 bytes on each logging occurrence.
>
> I wonder if anybody has experienced something similar to this?   
> After some investigation, I found out that the leak was caused by  
> the call to apr_sockaddr_info_get in the DatagramSocket::send 
> (DatagramPacketPtr& p) method (datagramsocket.cpp).  At this point  
> I wonder if I am missing something.  Any comment/help would be much  
> appreciated.
>
>
>
> Regards,
>
> Min

The implementation of DatagramSocket::send does not correspond to the  
source in the Apache SVN (http://svn.apache.org/viewcvs.cgi/logging/ 
log4cxx/trunk/src/datagramsocket.cpp?rev=308840&view=markup).  I  
assume the author intended to commit the code, but somehow it fell  
through the cracks and it only appears in the littletux tarball.

 From the fragment, it appears that DatagramSocket has a member  
variable named memoryPool of type log4cxx::helpers::Pool.  Memory  
allocated from that pool is not reclaimed until the pool is destroyed  
which explains the observed memory leakage.  I would recommend that  
the member variable be removed and a Pool& be passed as a parameter  
to the send function (and another other function that needs a memory  
pool).





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe