Hallo,
I am using log4cplus with a configuration file.
At the entry-point of my program I write:
PropertyConfigurator::doConfigure("log4cplus.properties");
In every cpp-file I define a static logger like this:
#include <log4cplus/logger.h>
#include <log4cplus/fileappender.h>
#include <log4cplus/loglevel.h>
#include <log4cplus/configurator.h>
using namespace log4cplus;
using namespace log4cplus::helper
Logger static logger = Logger::getInstance("myfilename.cpp");
And then I use the logging mechanisms:
LOG4CPLUS_DEBUG(logger, "My Message");
When finishing my Program, the Memory leak detector points to a lot of memory leaks. Most of them are coused by the line at the entry-point of my Programm:
PropertyConfigurator::doConfigure("log4cplus.properties");
Also some are caused by the Line:
Logger static logger = Logger::getInstance("myfilename.cpp");
Is there a bug, or do I use log4cplus in a wrong way?
Thanks, Anton
Hi.
There should not be any significant memory leaks in log4cplus. There were some minor leaks in 1.0.3 but those are fixed now.
There are some static variables holding dynamically allocated memory which seems to be considered as memory leak by some memory leak detectors. However even those are destroyed and the memory is freed at the time static variables are destroyed.
Unless the seemingly leaking memory increases during the run time of your application, or unless the amount is huge I would not worry much about it.
hi wilx,
thanks; I will use it that way!
You are right , I couldn't find acummulating memory leaks. There was always displayed the same number of 56 leaks.
Anton