I am trying to embed a WebBrowser Control in a C# Winform Application. This sounds easy enough. However I discovered that the WebBrowser control eats up a lot of memory ever
I ran into this problem while writing a small "slideshow" application for different intranet pages used by my company. The simplest solution I found was restarting the application after some fixed period of time, an hour in my case. This solution worked well for us because there wasn't a lot of user interaction with the browser.
Public Class MyApplication
Private _AppTimer As Timers.Timer
Public Sub New()
_AppTimer = New Timers.Timer()
_AppTimer.Interval = 1 * 60 * 60 * 1000 '1 Hour * 60 Min * 60 Sec * 1000 Milli
AddHandler _AppTimer.Elapsed, AddressOf AppTimer_Elapsed
_AppTimer.Start()
End Sub
Private Sub AppTimer_Elapsed(s As Object, e As Timers.ElapsedEventArgs)
Application.Restart()
End Sub
End Class
This assumes of course that you have a data persistence mechanism in place.