Log4cxx
  1. Log4cxx
  2. LOGCXX-269

RollingFileAppender leaks memory on rollover

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 0.10.0
    • Fix Version/s: None
    • Component/s: Appender
    • Labels:
      None
    • Environment:
      Windows XP SP2, VC++6

      Description

      I downloaded apache-log4cxx-0.10.0.zip, built using the steps in http://logging.apache.org/log4cxx/building/vstudio.html

      Then I begun using log4cxx0.10.0 in my VC6 project.
      When I run the application developed using VC6 (MFC), I observed that the Mem Usage (windows task manager) increases by an average of 20KB whenever the logging file rolls over to another one.

      Here is portions of my code.

      using namespace std;
      using namespace log4cxx;
      using namespace log4cxx::helpers;

      static LoggerPtr g_rootLogger;
      char *g_strconfigFile1;

      PropertyConfigurator::configure(g_strconfigFile1);
      g_rootLogger = Logger::getRootLogger();

      .
      .
      .

      DWORD CmdOutput (....)
      {
      .
      .
      .

      unsigned char *log4cxxBuf;

      log4cxxBuf=new unsigned char[LOG4CXXBUFMAX];

      if(log4cxxBuf!=NULL)

      { . . . LOG4CXX_DEBUG(g_rootLogger, "CmdOutput: OutDataBuffer = " << log4cxxBuf); . . . delete[] log4cxxBuf; }

      else
      dwReturnValue=ERROR_ALLOCATE_MEM;

      return dwReturnValue;
      }

      log4cxx.properties

      logDir=C:/SE/LOG
      log4j.rootLogger=INFO, A1
      log4j.appender.A1=org.apache.log4j.RollingFileAppender
      log4j.appender.A1.File=$

      {logDir}

      /SE.log
      log4j.appender.A1.MaxFileSize=5MB
      log4j.appender.A1.MaxBackupIndex=1000
      log4j.appender.A1.layout=org.apache.log4j.PatternLayout
      log4j.appender.A1.layout.ConversionPattern=%d

      {dd MM yyyy HH:mm:ss}

      %5p %L - %m%n

      The CmdOutput function is called continuously in a separate thread until the "Stop" button is clicked.
      This could run for weeks and undesirable if memory usage keep increasing.

      Is there any problems with my codes, properties file?

      Kindly advice.

      Thanks You.

        Activity

        kim peng quek created issue -
        Thorsten Schöning made changes -
        Field Original Value New Value
        Fix Version/s 0.10.0 [ 10782 ]
        Thorsten Schöning made changes -
        Summary RollingFileAppender RollingFileAppender leaks memory on rollover

          People

          • Assignee:
            Curt Arnold
            Reporter:
            kim peng quek
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development