Red Gate forums :: View topic - log4net memory leak?
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
ANTS Memory Profiler 7
ANTS Memory Profiler 7 forum

log4net memory leak?

Search in ANTS Memory Profiler 7 forum
Post new topic   Reply to topic
Jump to:  
Author Message
purplesoup



Joined: 24 Sep 2012
Posts: 2

PostPosted: Mon Sep 24, 2012 11:02 am    Post subject: log4net memory leak? Reply with quote

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);
}
Back to top
View user's profile Send private message
Chris.Allen



Joined: 12 Mar 2009
Posts: 547

PostPosted: Wed Dec 12, 2012 3:51 pm    Post subject: Reply with quote

The memory profiler should be able to tell you which objects are in memory and why- can you take several snapshots and try to identify objects that should not still be in memory? If log4net classes are leaking memory- this will show up well in the results which you can always send to us in support@red-gate.com
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group