logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark <mark6...@yahoo.com>
Subject Usage and VC 7.1 debugger memory leaks
Date Fri, 28 Jul 2006 17:29:07 GMT

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

2.  Static member for log4cxx declared as follows:

In header:

	static log4cxx::LoggerPtr logger;

In implementation file:



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

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?



Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

View raw message