views:

200

answers:

1

Hey Guys,

I have .Net 3.5 SP1 with developement done in WPF.

Whenver I run my WPF application I see a process named "PresentationFontCache" appears in my Process List (on Task Manager). The process, though appears harmless, actually resides in the memory even after the WPF application is closed. What is this process actually? What does it do?

So when I try to check the memory usage (by executing and closing the application numerous times) the process gives a feel that some memory is still in use. also I have observed that this process can turn nastily resource hungry (30% CPU usage and/or 100 MB memory usage under certain conditions!!!).

I located the windows service, named "Windows Presentation Foundation Font Cache 3.0.0.0", which is probably responsible for generating this process. This service claims that it optimizes performance of WPF applications by caching commonly used font data. WPF applications will start this service if it is not already running. It can be disabled, though doing so will degrade the performance of WPF applications..

But then why doesnt the windows service itself close the process after the WPF application is closed.

Or is it that this services actually caches the font information used for any WPF apps collectively so that next time any of the similar apps, when rerun, will use the cache without regenrating the fonts for the application? If so isnt that a type of data which cannot be garbage collected? Isnt that a probable cause leading to memory leak?

Please elight me.

Thx Vinit.

A: 

This service is designed to improve the performance of WPF applications and increase the amount of shared resources between WPF programs (or different instances of the same program). The source is available for it as part of the Reference Source Code Center, and some more information on WPF application performance in general can be found here.

There are isolated instances of where this service causes a problem, but for what it's doing I don't think that occasional CPU spikes and 100mb memory usage are problematic.

You can safely disable the service if you believe it is taking up too many resources, but you're better off profiling / measuring what effect that has on your application.

Matthew Steeples