Joined: 24 Sep 2012
|Posted: Mon Sep 24, 2012 11:02 am Post subject: log4net memory leak?
|We have an ASP.NET website where the memory isn't getting released.
I've been looking at my ANTS profiler information and seen calls from System.Web.NativeFileChangeNotification and also System.Threading.TimerCallback.
Searching on TimerCallback in our code comes up with a log4net file DOMConfigurator with the code below. Has anyone had any problems with log4net not releasing memory?
internal ConfigureAndWatchHandler(ILoggerRepository repository, FileInfo configFile)
m_repository = repository;
m_configFile = configFile;
// Create a new FileSystemWatcher and set its properties.
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Path = m_configFile.DirectoryName;
watcher.Filter = m_configFile.Name;
// Set the notification filters
watcher.NotifyFilter = NotifyFilters.CreationTime | NotifyFilters.LastWrite | NotifyFilters.FileName;
// Add event handlers. OnChanged will do for all event handlers that fire a FileSystemEventArgs
watcher.Changed += new FileSystemEventHandler(ConfigureAndWatchHandler_OnChanged);
watcher.Created += new FileSystemEventHandler(ConfigureAndWatchHandler_OnChanged);
watcher.Deleted += new FileSystemEventHandler(ConfigureAndWatchHandler_OnChanged);
watcher.Renamed += new RenamedEventHandler(ConfigureAndWatchHandler_OnRenamed);
// Begin watching.
watcher.EnableRaisingEvents = true;
// Create the timer that will be used to deliver events. Set as disabled
m_timer = new Timer(new TimerCallback(OnWhatchedFileChange), null, Timeout.Infinite, Timeout.Infinite);