logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steindl Christian" <c.stei...@pke.at>
Subject AW: Usage and VC 7.1 debugger memory leaks
Date Mon, 31 Jul 2006 07:35:49 GMT
Hi Mark,

I call log4cxx::LogManager::shutdown() before the program terminates. Besides there are some
other issues with memory leaks under Win32. Check out the following for patches too.

http://issues.apache.org/jira/browse/LOGCXX-140
http://issues.apache.org/jira/browse/LOGCXX-117

Greetz,
Chris
 

> -----Urspr√ľngliche Nachricht-----
> Von: Mark [mailto:mark6139@yahoo.com] 
> Gesendet: Freitag, 28. Juli 2006 19:29
> An: log4cxx-user@logging.apache.org
> Betreff: Usage and VC 7.1 debugger memory leaks
> 
> Hello,
> 
> I have found a few threads in the archive about memory leaks 
> reported by various versions of the MSVC debugger.  None of 
> these threads have contained any resolution that helps me 
> with my problem.
> 
> My problem occurs due to the way I am using the LoggerPtr, so 
> really what I am looking for is suggestions on how to do it 
> without causing these leaks (or if there is some reason I 
> don't need to worry about them).
> 
> I realize the common usage is to use a static instance in 
> each class that uses logging and name the logger after the 
> class.  If I do it this way, it works without the reported 
> leaks.  The problem is I do not want to do this, because I 
> don't want to have to change more than one class if I decide 
> to change logging mechanisms.
> 
> So I am trying to use a singleton wrapper class.  
> 
> The relevant characteristics of this class are:
> 
> 1.  Private constructor, public method to get an instance.
> 
> 2.  Static member for log4cxx declared as follows:
> 
> In header:
> 
> 	static log4cxx::LoggerPtr logger;
> 
> In implementation file:
> 
> log4cxx::LoggerPtr
> USTLogger::logger(Logger::getLogger("MyLogger"));
> 
> -------------------------------------------
> 
> I am linking the shared log4cxx.lib in another shared .lib 
> that is linked into my .exe
> 
> Just creating the logger as above results in the "leaks" 
> (i.e. whether I send anything to the log or not). 
> 
> I tried explicitly releasing the LoggerPtr by calling
> releaseRef() when my singleton is destroyed for good, but 
> that caused an access violation.
> 
> Does anyone have any suggestions/thoughts on this? 
> Specifically what is the best way to construct a wrapper 
> class for use with log4cxx?
> 
> Thanks,
> 
> Mark
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection 
> around http://mail.yahoo.com 
> 

Mime
View raw message