分页活动内存具有极高的利率磁盘,但不断的低内存占用 [英] Extremely high rates of paging active memory to disk but low constant memory usage

查看:177
本文介绍了分页活动内存具有极高的利率磁盘,但不断的低内存占用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题状态,我有高页文件活动的一个问题。

As the title states, I have a problem with high page file activity.

我开发了处理大量的图片,它从加载程序硬盘驱动器。
从每一个形象它会产生一些数据,我节省了名单。对于每一个图像3600,我的列表保存到硬盘驱动器,其大小约为5到10 MB。它是尽可能快,因为它可以运行,所以它最大程度的发挥一个CPU线程。

I am developing a program that process a lot of images, which it loads from the hard drive. From every image it generates some data, that I save on a list. For every 3600 images, I save the list to the hard drive, its size is about 5 to 10 MB. It is running as fast as it can, so it max out one CPU Thread.

该项目工程,它产生的,它应该是数据,但是当我分析它在Visual Studio中,我得到一个警告说: DA0014:分页活动内存极高率磁盘

The program works, it generates the data that it is supposed to, but when I analyze it in Visual Studio I get a warning saying: DA0014: Extremely high rates of paging active memory to disk.

该程序的内存,消费特征,根据任务管理器是大约50 MB,似乎是稳定的。当我运行程序我有大约2 GB冷落4 GB的,所以我想我不会跑出来的RAM。
http://i.stack.imgur.com/TDAB0.png

The memory comsumption of the program, according to Task Manager is about 50 MB and seems to be stable. When I ran the program I had about 2 GB left out of 4 GB, so I guess I am not running out of RAM. http://i.stack.imgur.com/TDAB0.png

DA0014规则说明说的页面输出的数/秒频率比页的数目大得多写入/秒,例如,因为页面输出/秒还包括从系统文件高速改变的数据的页面,然而,它并不总是容易确定其过程是分页为什么负有直接责任。

The DA0014 rule description says "The number of Pages Output/sec is frequently much larger than the number of Page Writes/sec, for example. Because Pages Output/sec also includes changed data pages from the system file cache. However, it is not always easy to determine which process is directly responsible for the paging or why."

这是否意味着我得到这样的警告,只是因为我从硬盘读取大量图像,或者是别的东西? 。真的不知道什么样的错误我正在寻找的

Does this mean that I get this warning simply because I read a lot of images from the hard drive, or is it something else? Not really sure what kind of bug I am looking for.

编辑:链接到插入的图片

Link to image inserted.

EDIT1。 :图像大小约为300 KB每个。我加载下一个前dipose每一个

The images size is about 300 KB each. I dipose each one before loading the next.

更新:从实验看起来像寻呼来自刚刚加载大量文件。正如我在C#或潜在的GDI + API的专家,我不知道哪个答案是最正确的。我选择了安德拉斯Zoltans的答案,因为它是很好的解释,并因为它似乎他做了很多工作,解释的理由像我这样的新人:)

UPDATE: Looks from experiments like the paging comes from just loading the large amount of files. As I am no expert in C# or the underlying GDI+ API, I don't know which of the answers are most correct. I chose Andras Zoltans answer as it was well explained and because it seems he did a lot of work to explain the reason to a newcomer like me:)

推荐答案

更新以下详细信息

工作设置你的应用程序的可能不是很大 - 但对于虚拟内存尺寸?寻呼可能发生,因为这一点,不只是因为它的物理尺寸。请参阅从在Windows 8上运行VS2012的的Process Explorer 这个屏幕截图:

The working set of your application might not be very big - but what about the virtual memory size? Paging can occur because of this and not just because of it's physical size. See this screen shot from Process Explorer of VS2012 running on Windows 8:

和在任务管理器?显然,对于同一进程的专用工作集是305,376Kb。

And on task manager? Apparently the private working set for the same process is 305,376Kb.

我们可以从这样的)任务管理器不一定能信任的和b)应用程序的大小在内存中,至于操作系统来说,是远远复杂得多,我们愿意认为。

We can take from this a) that Task Manager can't necessarily be trusted and b) an application's size in memory, as far as the OS is concerned, is far more complicated than we'd like to think.

您可能想看看这个。

分页是因为你做的文件和较高的最终数字几乎可以肯定,因为你正在使用的文件的数量是什么几乎可以肯定。这方面的一个简单的测试是尝试不同的数字文件,并生成沿着那些最后的分页数字的数据集。如果文件的数量是导致分页,然后你就会看到明显的相关性。

The paging is almost certainly because of what you do with the files and the high final figures almost certainly because of the number of files you're working with. A simple test of that would be experiment with different numbers of files and generate a dataset of final paging figures alongside those. If the number of files is causing the paging, then you'll see a clear correlation.

然后拿出任何处理(但保持图像的加载),你这样做,并再次比较 - 注意区别

Then take out any processing (but keep the image-loading) you do and compare again - note the difference.

然后完全存根出图像加载代码 - 注意区别

Then stub out the image-loading code completely - note the difference.

显然,你会看到在发生故障的最大降幅,当你拿出图像加载。

Clearly you'll see the biggest drop in faults when you take out the image loading.

现在,看的 Emgu.CV图片代码,它使用了图片类内部来获取图像位 - 所以这是+通过功能GdipLoadImageFromFile的(这个指数第二个条目))(使用系统资源,再加上潜在的大量字节数组)的图像解码 - 然后将数据复制到 GCHandle.Alloc 包含实际的RGB值未压缩字节数组。

Now, looking at the Emgu.CV Image code, it uses the Image class internally to get the image bits - so that's firing up GDI+ via the function GdipLoadImageFromFile (Second entry on this index)) to decode the image (using system resources, plus potentially large byte arrays) - and then it copies the data to an uncompressed byte array containing the actual RGB values.

这字节数组使用分配(也被包围 GC.AddMemoryPressure GC.RemoveMemoryPressure )来创建一个固定的字节数组保存图像数据(未压缩)。现在我.Net的内存管理方面的专家,但在我看来,我们有堆碎片的潜在这里,即使每个文件被加载顺序,而不是并行。

This byte array is allocated using GCHandle.Alloc (also surrounded by GC.AddMemoryPressure and GC.RemoveMemoryPressure) to create a pinned byte array to hold the image data (uncompressed). Now I'm no expert on .Net memory management, but it seems to me that what we have a potential for heap fragmentation here, even if each file is loaded sequentially and not in parallel.

不管是导致强制分页我不知道。但似乎可能的。

Whether that's causing the hard paging I don't know. But it seems likely.

在特定图像的内存中表示可以具体地围绕显示而不是作为原始文件的字节为目标。所以,如果我们谈论的JPEG文件,例如,然后300KB JPEG可能是在物理内存相当大,这取决于它的大小。例如。一个1027x768的32位图像为3MB - 而这已分配的两次,因为它的加载的每个图像(一次分配),然后复制(第二次分配)到EMGU图像对象被设置在

In particular the in-memory representation of the image could be specifically geared around displaying as opposed to being the original file bytes. So if we're talking JPEGs, for example, then a 300Kb JPEG could be considerably larger in physical memory, depending on its size. E.g. a 1027x768 32 bit image is 3Mb - and that's been allocated twice for each image since it's loaded (first allocation) then copied (second allocation) into the EMGU image object before being disposed.

但你要问自己是否有必要找到解决问题的途径。如果应用程序没有消耗大量的物理内存,那么就会有很多的其他应用程序的影响较小;一个进程击中页面文件许许多多不会严重影响另一个进程还是不行,如果有足够的物理内存。

But you have to ask yourself if it's necessary to find a way around the problem. If your application is not consuming vast amounts of physical RAM, then it will have much less of an impact on other applications; one process hitting the page file lots and lots won't badly affect another process that doesn't, if there's sufficient physical memory.

这篇关于分页活动内存具有极高的利率磁盘,但不断的低内存占用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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