Archives

Times Reader memory shock

I’m an admirer of Times Reader; in fact I’ve become something of an addict. Then a discussion about .NET performance prompted me to check the memory usage:

At 92MB working set and 50MB private working set, this application uses an alarming amount of memory. I found this interesting as it’s an example of a real-world Windows Presentation Foundation application. WPF is great to work with, but if it catches on, how many concurrent WPF apps will we be able to run before our shiny Vista systems choke?

Caveats: All three of Vista, WPF and Times Reader are in beta, so things could improve; then again all three are close to release, so this is a real concern. More research is needed.

Of course it’s possible that Times Reader is just holding far too much data in RAM, though it is such a great app in other respects that it is hard to believe.

Other points of interest: as you can see from the screenshot I have Paint.Net running as well as another .NET app, Guidance Explorer, both of which consume less than half the amount of memory. In fact, Paint.Net’s usage is not bad in this context, given its sophistication and the fact that image apps tend to be memory-hungry.

I’ll have another look when the full releases are available.

Update

I investigated how much overhead WPF is introducing by comparing two trivial to-do list apps of identical functionality. One is XAML/VB.NET; the other is Windows Forms. Both compiled to release builds in VS 2005. Here are the results:

XAML/VB.NET

Working set: 30MB
Private working set: 11MB
Commit size: 44.5 MB

Windows Forms

Working set: 13.5MB
Private working set: 3MB
Commit size: 15MB

So on the face of it, there is a substantial memory jump for WPF.

Tags:


Related posts:

  1. Farewell to the Times Reader
  2. New York Times switches from WPF/Silverlight to Flash and AIR for Reader 2
  3. Times Reader and offline Silverlight at Mix07
  4. Who needs AIR? NY Times does desktop Silverlight app for Mac
  5. Transactional memory draws applause at Mix07 UK

9 comments to Times Reader memory shock

  • RMD

    Task Manager is not a reliable way to estimate memory usage of managed applications. (Applications running on the .NET Framework.)

    As memory pressure increases, these applications will change their memory usage to compensate.

  • Tim Anderson

    > As memory pressure increases, these applications will change their memory usage
    > to compensate.

    It’s true that this is complex, but you are being over-optimistic. The figure in Private Working Set is memory that can’t be shared with other processes – though it can be swapped to disk. 50MB private working set is a lot however you spin it.

    Tim

  • Ian

    It won’t necessarily be 50MB private in all circumstances. I run Times Reader on a small laptop that is memory constrained and it only has a 15MB working set.

    Another thing to remember is that Task Manager can’t show you the kernel allocations that are generally much higher for a Win32 application than a XAML application so direct comparison are tricky. If you use vadump you’ll get a better sense of the all-up costs and can more easily compared managed and unmanaged applications.

    Even with vadump though you don’t get to see the impact of other system resources an application is using (services, disk IO, etc) that can chew up memory without it showing up in Taskman. Vista has this excellent performance console that can show you a lot more of what’s going on including disk acceess and the hard-fault per minute count. Hard faults are sometimes a better indicator of how memory usage is impacting application and system performance.

  • Tim Anderson

    Thanks Ian.

    I tried stressing my system by opening lots of apps; I got physical memory 85% used. Then I ran Times Reader. It still uses 35MB private working set.

    Running perfmon I was able to get at the old private bytes counter – which actually seems to be the same as the Commit Size in the new task manager (?). This is gloomy reading, as it shows Times Reader grabbing around 100MB of private bytes even on a memory-stressed system. The private working set is only that part of private bytes that is not swapped to disk, as far as I can tell.

    What private bytes figure do you get on your laptop?

    I realise, and your comments confirm, that this stuff is hard to measure in a helpful manner, but that doesn’t make it unimportant.

    Tim

  • Ian

    [Sorry, looks like my first reply didn’t make it, here it is again]

    On my 512MB laptop (1Ghz, no GPU) private bytes is 52MB. “Private bytes” is the space reserved in the page file should the whole thing need to paged out for some reason. More space is reserved than is actually needed in some case (like for statics) so again, it’s pretty complicated. It matters though if you care about how big your page file is but probably not otherwise as long as pages are not being continually swapped to disk and then brought back. If you’re seeing that then there is definitely something bad going on.

    Fwiw, on the same machine, IE showing the New York Times home page has a working set of about 20MB, 34MB private although it does use a lot more user\gdi which constitues another limited resource (desktop heap) that you have to watch in some cases.

    Neither apps are paging on my machine since I’m not doing much else at the moment 🙂

    Still, none of this is meant to suggest that Times Reader shouldn’t be better and use less memory or that it’s unimportant! Quite the opposite, this is a great discussion to have!

    Ian.

  • Tim Anderson

    Thanks Ian.

    It does appear that for some reason the app’s memory usage is better constrained on your laptop than on my desktop. Incidentally, I do get a substantial number of hard faults when I stress the machine by running lots of apps; but performance remains quite acceptable.

    Sorry about the posting problems; I’m migrating to WordPress soon.

    Tim

  • Anonymous

    Did you try the real fully monster WPF app –
    Expression Interactive Designer?

  • Tim Anderson

    Yes, I have Expression ID installed.

    If I run it and open one of the samples I get:

    Working Set: 77MB
    Private Bytes: 83MB

    Compared to Times Reader, that’s fairly encouraging (since it is a more complex app).

    Tim

  • Kiran Kumar

    If you closely observe, Times Reader seems to be like a Navigation based app. Articles change every day and has to be pulled from the source. It looks like each time you click to an article you are navigating to a new page with new content. Old page goes to the journaling store for you to navigate back. Well you do need a good user experience and a quick navigation back, right? Here the trade off is Memory V/s Speed. If I were to design this I would pick speed and keep the memory to GC to manage. I would keep the back navigated pages in a week reference. Week referenced content will be taken care by GC when system goes under pressure. This way I get both speed and memory when I need it.

    Where as Expression studio more looks like a tool with more of static contents. Obviously, the WorkingSet increase on Expression will be seen as lot smaller than Times Reader.

    Now other question was why private memory are more, well you have tons of images with article, unless managed reference to the images are gone, the unmanaged bytes representing the images will be alive. Again it’s totally depended on the GC.