You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Hemant <he...@in-reality.com> on 2004/07/27 12:28:20 UTC
Memory Leaks in Log4cxx
Hi,
I have installed log4cxx library on Windows xp. I have used the dll as well
as the static version of the library. I am almost certain that there are
memory leaks in the library.
Also when I used the dll version of the library I get a runtime error saying
"pure virtual function call" error no. R6025.
Do you have any fix for the memory leaks as well as the above mentioned
error.
Please let me know.
- Hemant Chiplunkar.
RE: Memory Leaks in Log4cxx
Posted by Michael CATANZARITI <mc...@free.fr>.
Hemant,
can you just copy your MSVC Output concerning the leaks in a mail, please ?
Selon Hemant <he...@in-reality.com>:
> Hi,
> I have used a win32 console based application. I already have attached the
> file and sent it across.
> Just in case you do not get it I have attached it with this mail. When you
> run it you will get the leaks listed in
> the output window.
>
> -Hemant
>
>
> -----Original Message-----
> From: Michael CATANZARITI [mailto:mcatan@free.fr]
> Sent: Tuesday, July 27, 2004 4:09 PM
> To: Log4CXX User
> Subject: Re: Memory Leaks in Log4cxx
>
>
> Hello,
>
> If you tested log4cxx with MFC, you will get false memory leaks because of
> static class members which are destroyed after the leak dump is displayed on
> the ouput.
> If not, please send your leak dump to the mailing list.
>
> Michaël
>
> Selon Christophe de VIENNE <cd...@alphacent.com>:
>
> > Hi,
> >
> >
> > Hemant wrote:
> >
> > >Hi,
> > >I have installed log4cxx library on Windows xp. I have used the dll as
> well
> > >as the static version of the library. I am almost certain that there are
> > >memory leaks in the library.
> > >
> > >
> >
> > Could you be more precise about the memory leak(s) ? What make you think
> > that and do you have presumption on where ?
> >
> >
> > >Also when I used the dll version of the library I get a runtime error
> saying
> > >"pure virtual function call" error no. R6025.
> > >
> > >
> >
> > On which function call ?
> >
> > >Do you have any fix for the memory leaks as well as the above mentioned
> > >error.
> > >
> > >
> >
> > I don't know about it.
> >
> >
> > Cheers,
> >
> > Christophe
> >
>
>
>
Re: Memory Leaks in Log4cxx
Posted by Michael CATANZARITI <mc...@free.fr>.
I think it's the same problem.
By using the _CRTDBG_REPORT_FLAG flag, it should work.
Michaël
Selon Christophe de VIENNE <cd...@alphacent.com>:
> Hi,
>
>
> FabijanicA@nucorsteel.com wrote:
>
> >There are 13 memory leaks and 7 resource leaks reported at the end of
> >execution. I am still trying to figure out most of them, but here's where
> >some of the leaks reported are coming from:
> >
> >timezone.cpp line 32 [2 leaks - calling tzset and gmtime]:
> >TimeZonePtr TimeZone::defaultTimeZone = new TimeZone(_T(""));
> >
> >
>
> gmtime returns a "struct tm *", which is, refering to the man page :
>
> "The return value points to a statically allocated struct which might be
> overwritten by subsequent calls to any of the date and time
> functions."
>
> This struct is probably allocated at the first call to gmtime, and then
> never freed.
> I guess the tzset leak has the same reason.
>
> This is for the glibc version of those functions thought. If their win32
> equivalent return dynamically allocated memory, then the code needs to
> be patched to free the memory.
>
> >timezone.cpp line 92 [1 leak - calling putenv]: return
> >new TimeZone(ID);
> >
> >
>
> This function alterate the environment. If some memory is allocated I
> don't think it's supposed to be freed.
>
> >tzset(), gmtime() and putenv are all calling malloc()
> >
> >
>
> With my understanding of their behavior (under linux, it may be
> different with the vc++ standard C library), they won't call it each
> time, but rather once for tzset and gmtime, and if needed a few time for
> putenv.
>
> So those leaks are "normal" from the log4cxx point of view, ie we can't
> do anything about it...
>
>
>
> Regards,
>
> Christophe
>
Re: Memory Leaks in Log4cxx
Posted by Fa...@nucorsteel.com.
Christophe de
VIENNE
<cdevienne@alphac To
ent.com> Log4CXX User
<lo...@logging.apache.org>
07/27/2004 09:29 cc
AM
Subject
Re: Memory Leaks in Log4cxx
Please respond to
"Log4CXX User"
<log4cxx-user@log
ging.apache.org>
>This is for the glibc version of those functions thought. If their win32
>equivalent return dynamically allocated memory, then the code needs to
>be patched to free the memory.
I don't think windows version is different from unix one.
Multihreaded version of the library allocates the memory needed for the
structure once per each thread.
Hemant, try to run attached example. You should get dumps only at the end
of program, not inside the loop.
(See attached file: chkpoint.cpp)
Re: Memory Leaks in Log4cxx
Posted by Christophe de VIENNE <cd...@alphacent.com>.
Hi,
FabijanicA@nucorsteel.com wrote:
>There are 13 memory leaks and 7 resource leaks reported at the end of
>execution. I am still trying to figure out most of them, but here's where
>some of the leaks reported are coming from:
>
>timezone.cpp line 32 [2 leaks - calling tzset and gmtime]:
>TimeZonePtr TimeZone::defaultTimeZone = new TimeZone(_T(""));
>
>
gmtime returns a "struct tm *", which is, refering to the man page :
"The return value points to a statically allocated struct which might be
overwritten by subsequent calls to any of the date and time
functions."
This struct is probably allocated at the first call to gmtime, and then
never freed.
I guess the tzset leak has the same reason.
This is for the glibc version of those functions thought. If their win32
equivalent return dynamically allocated memory, then the code needs to
be patched to free the memory.
>timezone.cpp line 92 [1 leak - calling putenv]: return
>new TimeZone(ID);
>
>
This function alterate the environment. If some memory is allocated I
don't think it's supposed to be freed.
>tzset(), gmtime() and putenv are all calling malloc()
>
>
With my understanding of their behavior (under linux, it may be
different with the vc++ standard C library), they won't call it each
time, but rather once for tzset and gmtime, and if needed a few time for
putenv.
So those leaks are "normal" from the log4cxx point of view, ie we can't
do anything about it...
Regards,
Christophe
Timezone side effects (was Re: Memory Leaks in Log4cxx)
Posted by Curt Arnold <ca...@houston.rr.com>.
On Jul 27, 2004, at 7:29 AM, FabijanicA@nucorsteel.com wrote:
> There are 13 memory leaks and 7 resource leaks reported at the end of
> execution. I am still trying to figure out most of them, but here's
> where
> some of the leaks reported are coming from:
>
> timezone.cpp line 32 [2 leaks - calling tzset and gmtime]:
> TimeZonePtr TimeZone::defaultTimeZone = new TimeZone(_T(""));
> timezone.cpp line 92 [1 leak - calling putenv]:
> return
> new TimeZone(ID);
>
> tzset(), gmtime() and putenv are all calling malloc()
>
I had been troubled by timezone.cpp, but have not had time to
investigate the issue. It appears that it could have unintended side
effects since it appears to be setting the current timezone not just
for the logging code but for the application as a whole.
RE: Memory Leaks in Log4cxx
Posted by Fa...@nucorsteel.com.
I mixed the line numbers - they are swapped, the first line was 92, the
second one 32.
FabijanicA@nucors
teel.com
To
07/27/2004 08:29 "Log4CXX User"
AM <lo...@logging.apache.org>
cc
Please respond to Subject
"Log4CXX User" RE: Memory Leaks in Log4cxx
<log4cxx-user@log
ging.apache.org>
There are 13 memory leaks and 7 resource leaks reported at the end of
execution. I am still trying to figure out most of them, but here's where
some of the leaks reported are coming from:
timezone.cpp line 32 [2 leaks - calling tzset and gmtime]:
TimeZonePtr TimeZone::defaultTimeZone = new TimeZone(_T(""));
timezone.cpp line 92 [1 leak - calling putenv]: return
new TimeZone(ID);
tzset(), gmtime() and putenv are all calling malloc()
Apparently resource leaks all have to do with InitializeCriticalSection
calls not having matching DeletecriticalSection prior to terminate.
I have been running a real world process using log4cxx for about a week now
and I do see small increase in process memory and number of handles over
time.
I'll keep on looking.
+++
Aleksandar Fabijanic
Level 2 Automation Engineer
Nucor Steel Berkeley - Beam Mill
Phone: 843.336.6678
Fax: 843.336.6072
---
Hemant
<hemantc@in-reali
ty.com> To
'Log4CXX User'
07/27/2004 06:56 <lo...@logging.apache.org>
AM cc
Subject
Please respond to RE: Memory Leaks in Log4cxx
"Log4CXX User"
<log4cxx-user@log
ging.apache.org>
Hi,
I have used a win32 console based application. I already have attached the
file and sent it across.
Just in case you do not get it I have attached it with this mail. When you
run it you will get the leaks listed in
the output window.
-Hemant
-----Original Message-----
From: Michael CATANZARITI [mailto:mcatan@free.fr]
Sent: Tuesday, July 27, 2004 4:09 PM
To: Log4CXX User
Subject: Re: Memory Leaks in Log4cxx
Hello,
If you tested log4cxx with MFC, you will get false memory leaks because of
static class members which are destroyed after the leak dump is displayed
on
the ouput.
If not, please send your leak dump to the mailing list.
Michaël
Selon Christophe de VIENNE <cd...@alphacent.com>:
> Hi,
>
>
> Hemant wrote:
>
> >Hi,
> >I have installed log4cxx library on Windows xp. I have used the dll as
well
> >as the static version of the library. I am almost certain that there are
> >memory leaks in the library.
> >
> >
>
> Could you be more precise about the memory leak(s) ? What make you think
> that and do you have presumption on where ?
>
>
> >Also when I used the dll version of the library I get a runtime error
saying
> >"pure virtual function call" error no. R6025.
> >
> >
>
> On which function call ?
>
> >Do you have any fix for the memory leaks as well as the above mentioned
> >error.
> >
> >
>
> I don't know about it.
>
>
> Cheers,
>
> Christophe
>
(See attached file: testapp.cpp)(See attached file: testapp.cpp)
RE: Memory Leaks in Log4cxx
Posted by Fa...@nucorsteel.com.
And here is the actual dump:
(See attached file: memleaks.txt)
RE: Memory Leaks in Log4cxx
Posted by Fa...@nucorsteel.com.
There are 13 memory leaks and 7 resource leaks reported at the end of
execution. I am still trying to figure out most of them, but here's where
some of the leaks reported are coming from:
timezone.cpp line 32 [2 leaks - calling tzset and gmtime]:
TimeZonePtr TimeZone::defaultTimeZone = new TimeZone(_T(""));
timezone.cpp line 92 [1 leak - calling putenv]: return
new TimeZone(ID);
tzset(), gmtime() and putenv are all calling malloc()
Apparently resource leaks all have to do with InitializeCriticalSection
calls not having matching DeletecriticalSection prior to terminate.
I have been running a real world process using log4cxx for about a week now
and I do see small increase in process memory and number of handles over
time.
I'll keep on looking.
+++
Aleksandar Fabijanic
Level 2 Automation Engineer
Nucor Steel Berkeley - Beam Mill
Phone: 843.336.6678
Fax: 843.336.6072
---
Hemant
<hemantc@in-reali
ty.com> To
'Log4CXX User'
07/27/2004 06:56 <lo...@logging.apache.org>
AM cc
Subject
Please respond to RE: Memory Leaks in Log4cxx
"Log4CXX User"
<log4cxx-user@log
ging.apache.org>
Hi,
I have used a win32 console based application. I already have attached the
file and sent it across.
Just in case you do not get it I have attached it with this mail. When you
run it you will get the leaks listed in
the output window.
-Hemant
-----Original Message-----
From: Michael CATANZARITI [mailto:mcatan@free.fr]
Sent: Tuesday, July 27, 2004 4:09 PM
To: Log4CXX User
Subject: Re: Memory Leaks in Log4cxx
Hello,
If you tested log4cxx with MFC, you will get false memory leaks because of
static class members which are destroyed after the leak dump is displayed
on
the ouput.
If not, please send your leak dump to the mailing list.
Michaël
Selon Christophe de VIENNE <cd...@alphacent.com>:
> Hi,
>
>
> Hemant wrote:
>
> >Hi,
> >I have installed log4cxx library on Windows xp. I have used the dll as
well
> >as the static version of the library. I am almost certain that there are
> >memory leaks in the library.
> >
> >
>
> Could you be more precise about the memory leak(s) ? What make you think
> that and do you have presumption on where ?
>
>
> >Also when I used the dll version of the library I get a runtime error
saying
> >"pure virtual function call" error no. R6025.
> >
> >
>
> On which function call ?
>
> >Do you have any fix for the memory leaks as well as the above mentioned
> >error.
> >
> >
>
> I don't know about it.
>
>
> Cheers,
>
> Christophe
>
(See attached file: testapp.cpp)
RE: Memory Leaks in Log4cxx
Posted by Hemant <he...@in-reality.com>.
Hi,
I have used a win32 console based application. I already have attached the
file and sent it across.
Just in case you do not get it I have attached it with this mail. When you
run it you will get the leaks listed in
the output window.
-Hemant
-----Original Message-----
From: Michael CATANZARITI [mailto:mcatan@free.fr]
Sent: Tuesday, July 27, 2004 4:09 PM
To: Log4CXX User
Subject: Re: Memory Leaks in Log4cxx
Hello,
If you tested log4cxx with MFC, you will get false memory leaks because of
static class members which are destroyed after the leak dump is displayed on
the ouput.
If not, please send your leak dump to the mailing list.
Michaël
Selon Christophe de VIENNE <cd...@alphacent.com>:
> Hi,
>
>
> Hemant wrote:
>
> >Hi,
> >I have installed log4cxx library on Windows xp. I have used the dll as
well
> >as the static version of the library. I am almost certain that there are
> >memory leaks in the library.
> >
> >
>
> Could you be more precise about the memory leak(s) ? What make you think
> that and do you have presumption on where ?
>
>
> >Also when I used the dll version of the library I get a runtime error
saying
> >"pure virtual function call" error no. R6025.
> >
> >
>
> On which function call ?
>
> >Do you have any fix for the memory leaks as well as the above mentioned
> >error.
> >
> >
>
> I don't know about it.
>
>
> Cheers,
>
> Christophe
>
Re: Memory Leaks in Log4cxx
Posted by Michael CATANZARITI <mc...@free.fr>.
Hello,
If you tested log4cxx with MFC, you will get false memory leaks because of
static class members which are destroyed after the leak dump is displayed on
the ouput.
If not, please send your leak dump to the mailing list.
Michaël
Selon Christophe de VIENNE <cd...@alphacent.com>:
> Hi,
>
>
> Hemant wrote:
>
> >Hi,
> >I have installed log4cxx library on Windows xp. I have used the dll as well
> >as the static version of the library. I am almost certain that there are
> >memory leaks in the library.
> >
> >
>
> Could you be more precise about the memory leak(s) ? What make you think
> that and do you have presumption on where ?
>
>
> >Also when I used the dll version of the library I get a runtime error saying
> >"pure virtual function call" error no. R6025.
> >
> >
>
> On which function call ?
>
> >Do you have any fix for the memory leaks as well as the above mentioned
> >error.
> >
> >
>
> I don't know about it.
>
>
> Cheers,
>
> Christophe
>
RE: Memory Leaks in Log4cxx
Posted by Hemant <he...@in-reality.com>.
Hi,
I tried it already, and then I changed it back to what you see now. I still
get the runtime error
"pure virutal function call".
-Hemant
-----Original Message-----
From: Michael CATANZARITI [mailto:mcatan@free.fr]
Sent: Tuesday, July 27, 2004 5:47 PM
To: Log4CXX User
Subject: RE: Memory Leaks in Log4cxx
Heman,
I think I have understood the problem.
On line 29, please change
Logger *pMylogger = Logger::getLogger(_T("MgmtServer"));
by
LoggerPtr pMylogger = Logger::getLogger(_T("MgmtServer"));
and let us know if it works.
Michaël
Selon Hemant <he...@in-reality.com>:
> Hi,
> Sorry about the file. This is the latest version of the file. I have
> attached it again.
>
> -Hemant
>
> -----Original Message-----
> From: Christophe de VIENNE [mailto:cdevienne@alphacent.com]
> Sent: Tuesday, July 27, 2004 4:01 PM
> To: Log4CXX User
> Subject: Re: Memory Leaks in Log4cxx
>
>
> Hi,
>
>
> Hemant wrote:
>
> >Hi,
> >I have installed log4cxx library on Windows xp. I have used the dll as
well
> >as the static version of the library. I am almost certain that there are
> >memory leaks in the library.
> >
> >
>
> Could you be more precise about the memory leak(s) ? What make you think
> that and do you have presumption on where ?
>
>
> >Also when I used the dll version of the library I get a runtime error
> saying
> >"pure virtual function call" error no. R6025.
> >
> >
>
> On which function call ?
>
> >Do you have any fix for the memory leaks as well as the above mentioned
> >error.
> >
> >
>
> I don't know about it.
>
>
> Cheers,
>
> Christophe
>
RE: Memory Leaks in Log4cxx
Posted by Michael CATANZARITI <mc...@free.fr>.
Heman,
I think I have understood the problem.
On line 29, please change
Logger *pMylogger = Logger::getLogger(_T("MgmtServer"));
by
LoggerPtr pMylogger = Logger::getLogger(_T("MgmtServer"));
and let us know if it works.
Michaël
Selon Hemant <he...@in-reality.com>:
> Hi,
> Sorry about the file. This is the latest version of the file. I have
> attached it again.
>
> -Hemant
>
> -----Original Message-----
> From: Christophe de VIENNE [mailto:cdevienne@alphacent.com]
> Sent: Tuesday, July 27, 2004 4:01 PM
> To: Log4CXX User
> Subject: Re: Memory Leaks in Log4cxx
>
>
> Hi,
>
>
> Hemant wrote:
>
> >Hi,
> >I have installed log4cxx library on Windows xp. I have used the dll as well
> >as the static version of the library. I am almost certain that there are
> >memory leaks in the library.
> >
> >
>
> Could you be more precise about the memory leak(s) ? What make you think
> that and do you have presumption on where ?
>
>
> >Also when I used the dll version of the library I get a runtime error
> saying
> >"pure virtual function call" error no. R6025.
> >
> >
>
> On which function call ?
>
> >Do you have any fix for the memory leaks as well as the above mentioned
> >error.
> >
> >
>
> I don't know about it.
>
>
> Cheers,
>
> Christophe
>
RE: Memory Leaks in Log4cxx
Posted by Hemant <he...@in-reality.com>.
Hi,
Sorry about the file. This is the latest version of the file. I have
attached it again.
-Hemant
-----Original Message-----
From: Christophe de VIENNE [mailto:cdevienne@alphacent.com]
Sent: Tuesday, July 27, 2004 4:01 PM
To: Log4CXX User
Subject: Re: Memory Leaks in Log4cxx
Hi,
Hemant wrote:
>Hi,
>I have installed log4cxx library on Windows xp. I have used the dll as well
>as the static version of the library. I am almost certain that there are
>memory leaks in the library.
>
>
Could you be more precise about the memory leak(s) ? What make you think
that and do you have presumption on where ?
>Also when I used the dll version of the library I get a runtime error
saying
>"pure virtual function call" error no. R6025.
>
>
On which function call ?
>Do you have any fix for the memory leaks as well as the above mentioned
>error.
>
>
I don't know about it.
Cheers,
Christophe
RE: Memory Leaks in Log4cxx
Posted by Hemant <he...@in-reality.com>.
Hi,
I have attached the c++ file along with this mail. Just run this code with
dll version of the log4cxx library.
>Could you be more precise about the memory leak(s) ? What make you think
>that and do you have presumption on where ?
After running this file you can see the memory leaks dumped in the output
window of visual c++ editor. Currently I am
using Visual C++ 6.0.
>On which function call ?
I get the error just before the program exits.
-Hemant
-----Original Message-----
From: Christophe de VIENNE [mailto:cdevienne@alphacent.com]
Sent: Tuesday, July 27, 2004 4:01 PM
To: Log4CXX User
Subject: Re: Memory Leaks in Log4cxx
Hi,
Hemant wrote:
>Hi,
>I have installed log4cxx library on Windows xp. I have used the dll as well
>as the static version of the library. I am almost certain that there are
>memory leaks in the library.
>
>
Could you be more precise about the memory leak(s) ? What make you think
that and do you have presumption on where ?
>Also when I used the dll version of the library I get a runtime error
saying
>"pure virtual function call" error no. R6025.
>
>
On which function call ?
>Do you have any fix for the memory leaks as well as the above mentioned
>error.
>
>
I don't know about it.
Cheers,
Christophe
Re: Memory Leaks in Log4cxx
Posted by Christophe de VIENNE <cd...@alphacent.com>.
Hi,
Hemant wrote:
>Hi,
>I have installed log4cxx library on Windows xp. I have used the dll as well
>as the static version of the library. I am almost certain that there are
>memory leaks in the library.
>
>
Could you be more precise about the memory leak(s) ? What make you think
that and do you have presumption on where ?
>Also when I used the dll version of the library I get a runtime error saying
>"pure virtual function call" error no. R6025.
>
>
On which function call ?
>Do you have any fix for the memory leaks as well as the above mentioned
>error.
>
>
I don't know about it.
Cheers,
Christophe