Windows中的内存映射文件。 [英] Memory mapping filein Windows.

查看:172
本文介绍了Windows中的内存映射文件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过内存映射文件机制。在这里我对文件映射对象有疑问。如下面的链接所示:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa366542(v = vs.85).aspx [ ^ ]

它是提到由命名文件支持的文件映射对象的大小受磁盘空间的限制。

所以我的问题是,无论如何我们将文件映射到物理内存中,所以,isn'这就像物理内存的大小限制了文件映射对象的最大大小。

实际上文件映射对象是什么:是否是原始文件的克隆(在RAM中)在磁盘上或它就像处理原始文件一样。

文件映射对象大小的限制因素是什么。

文章中还有一行是因为它没有花费你任何系统资源来创建更大的文件映射对象,这意味着什么,因为在您创建文件映射对象时,您正在使用物理内存。

请解释这一切,如果我不对,请告诉我。



提前致谢。

I was going through memory mapping file mechanism. Here I have a doubt regarding File mapping object. As mentioned in below link:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366542(v=vs.85).aspx[^]
It is mentioned that "The size of a file mapping object that is backed by a named file is limited by disk space."
So my question is that in any case we map file in physical memory so , isn't it like that the size of physical memory limits the maximum size of file mapping object.
What actually file mapping object is : whether it is clone of original file(in RAM) which is on disk or it is something like handle to that original file.
And what are the limiting factors of size of file mapping object.
One more line in the article is "Since it does not cost you any system resources to create a larger file mapping object", what does it mean as it seems to that when you create a file mapping object u are using physical memory.
Please explain all this and let me know in case i am not correct.

Thanks in advance.

推荐答案

内存映射文件就像在内存中一样,但实际上并非如此。您可以使用它,就像它完全在内存中,而OS试图预测并且必须使用您读取的文件的位置来修复实际内存。它使得编程人员可以更轻松地处理非常大的文件,因为您不必担心文件的某些部分是否在内存中。这全部由操作系统处理。它确实使用了physycal内存,但与实际文件大小相比只是一个相对较小的窗口。



祝你好运!
A memory mapped file acts as if it is in memory but actually is not. You can just use it like it is completely in memory while the OS tries to predict and has to fixup actual memory with locations of the file you read. It makes working with very large files easier for programmers because you don't have to worry about some part of the file is in memory or not. This is all handled by the OS. It does use physycal memory, but only a relative small window compared to the actual file size.

Good luck!


这篇关于Windows中的内存映射文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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