title: WPF - NavigationService memory troubles
body: <p>I needed to write an application for kiosk terminal and I choose WPF for this, because I need single window application. Implementation is simple - NavigationWindow and set of Pages, that uses in NavigationService.Navigate() method.</p>
  
  <p>During using the application, I saw that it freezes, consuming large amount of memory. I found that when content is navigated to, NavigationService records the navigation as an entry in navigation history. I started to clean up history by using NavigationService.RemoveBackEntry() method.</p>
  
  <p>Yes - history is cleared, but page's finallizers doesn't call. Pages are still being in memory and finallizers call only when the application is closed. I can just go from one page to another and then go back several times - application will consume about 150-200 Mb (starts from 5-6 Mb).</p>
  
  <p>I checked the application with memory profiler and found that used memory doesn't increased - its about 5-8 Mb, but working set consume large amount of memory.</p>
  
  <p>So I found a way to clear working set, but I didn't leave a thought that it is a wrong way. Solution must be more easier.</p>
  
  <p>Documentation says that NavigationService does not store an instance of a content object in navigation history. Instead, NavigationService creates a new instance of the content object each time it is navigated to by using navigation history. This behavior is designed to avoid excessive memory consumption. But as I see it doesn't work this way.</p>
  
  <p>I was thought that this behavior works only when NavigationService use URI for navigation (I call Navigate(new MyPage()) for navigating), but is doesn't work even with URI - pages instances still being in memory even if I clear the history journal.</p>
  
  <p>So here is the questions:</p>
  
  <p>1) Anyone else faced a similar problem?</p>
  
  <p>2) Is that correct and best way to use NavigationWindow to build a single-window application?</p>