WPF PresentationFontCache.这是什么? [英] WPF PresentationFontCache. What is this?

查看:129
本文介绍了WPF PresentationFontCache.这是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有.Net 3.5 SP1,并且已在WPF中完成开发.

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

每当我运行WPF应用程序时,都会看到一个名为"PresentationFontCache"的进程出现在我的进程列表"中(在任务管理器"上).尽管该过程看起来无害,但即使在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?

因此,当我尝试检查内存使用情况(通过多次执行和关闭应用程序)时,该过程使您感到某些内存仍在使用中.我还观察到,此过程可能会使资源变得极度饥饿(在某些情况下,CPU使用率为30%和/或100 MB内存!!!).

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!!!).

我找到了名为"Windows Presentation Foundation Font Cache 3.0.0.0"的Windows服务,该服务可能负责生成此过程.该服务声称它通过缓存常用字体数据来优化WPF应用程序的性能.如果WPF应用程序尚未运行,它将启动它.可以禁用它,尽管这样做会降低WPF应用程序的性能.

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..

但是,为什么在WPF应用程序关闭后Windows服务本身不关闭进程.

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

还是该服务实际上共同缓存了所有WPF应用程序使用的字体信息,以便下次任何类似的应用程序在重新运行时都将使用该缓存,而不会重新生成该应用程序的字体吗?如果不是这样,那么就不能进行垃圾收集吗?那不是导致内存泄漏的可能原因吗?

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?

请照亮我.

Thx 维尼特.

推荐答案

此服务旨在提高WPF应用程序的性能并增加WPF程序(或同一程序的不同实例)之间的共享资源量.源代码可以作为

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.

在某些情况下,此服务会导致问题,但是对于它所做的事情,我并不认为偶尔出现CPU高峰和100mb的内存使用是有问题的.

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.

这篇关于WPF PresentationFontCache.这是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆