Uploaded image for project: 'Log4cxx'
  1. Log4cxx
  2. LOGCXX-390

xml::DOMConfigurator::configureAndWatch leaks memory and threads like LOGCXX-342

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.11.0
    • Fix Version/s: None
    • Component/s: Configurator
    • Labels:
      None
    • Environment:
      windows

      Description

      Each call to configureAndWatch causes a new FileWatcher object to be created (without deleting the old one) and consequently a new thread to be created (even though the old one may still be running).

      It problem may be fixed by creating
      std::vector<std::tr1::shared_ptr<FileWatchdog>> vecWatchDog;

      change
      // XMLWatchdog * xdog = new XMLWatchdog(file);
      // xdog->setDelay(delay);
      // xdog->start();
      std::tr1::shared_ptr<FileWatchdog> xdog((FileWatchdog*)new XMLWatchdog(file));
      xdog->setDelay(delay);
      xdog->start();
      vecWatchDog.push_back(xdog);

      and adding
      void xml::DOMConfigurator::stopAllWatch()
      {
      vecWatchDog.clear();
      }

      for correctly stoped FileWatchers on application exit befor destroing Pool objects. Or need create vecWatchDog on Pool.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jsouthwell Joseph Southwell
                Reporter:
                victorgs Victor
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: