-
Notifications
You must be signed in to change notification settings - Fork 105
Open
Description
As indicated in Issue #120, memory leaks have been reported by iEmiya. Leaks can be reproduced with this test:
A simple test for memory leaks.
[Test]
public void MemoryLeak()
{
// look : exception
long? useTotalMemory = null;
var task = System.Threading.Tasks.Task.Factory.StartNew(() =>
{
long threadId = 1;
while (true)
{
long totalMemory = GC.GetTotalMemory(false);
Trace.WriteLine(string.Format("Use total memory: {0:#,##0} byte(s)", totalMemory));
if (threadId % 20 == 0)
{
if (!useTotalMemory.HasValue) useTotalMemory = totalMemory;
else
{
if (totalMemory > useTotalMemory) throw new ApplicationException("Memory leak in 'SimpleBrowser'");
break; // Ok
}
}
try
{
threadId++;
Browser b1 = new Browser(Helper.GetFramesMock());
b1.Navigate("http://localhost/");
if (threadId % 2 == 0) throw new ApplicationException();
b1.Close();
GC.WaitForPendingFinalizers();
GC.Collect();
}
catch (Exception e)
{
Trace.Fail("Failed to navigate");
}
}
});
task.Wait();
}Metadata
Metadata
Assignees
Labels
No labels