Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SEC_COMMIT usefulness in CreateFileMapping API

192 views
Skip to first unread message

curious1

unread,
Oct 19, 2008, 8:18:17 PM10/19/08
to
Hi All,

I am trying to understand importance of SEC_COMMIT section attibute when
using CreateFileMapping API to share mapped file between two processes.

I am using hFile as INVALID_HANDLE_VALUE. which means no file is created in
filesystem, so file will will be mapped into memory directly. How can I
prevent this file frombeing paged out of memory and in case it is paged out,
will the OS save this somewhere on filesystem ? How will this work if I have
not given a valid file handle (basically no file exist in filesystem) ?

please help me understand this. I truly appreciate your time ...

thanks !

HANDLE CreateFileMapping(
HANDLE hFile,
LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
DWORD flProtect,
DWORD dwMaximumSizeHigh,
DWORD dwMaximumSizeLow,
LPCTSTR lpName
);

Michel Verhagen (eMVP)

unread,
Oct 19, 2008, 8:33:57 PM10/19/08
to
Windows CE does not use a page file, which means that non file-backed
data (such as a memory mapped file without a base file in the
filesystem) will never be paged out to disk.

See
http://blogs.msdn.com/ce_base/archive/2008/01/19/Paging-and-the-Windows-CE-Paging-Pool.aspx


Good luck,

Michel Verhagen, eMVP
Check out my blog: http://GuruCE.com/blog

GuruCE
Microsoft Embedded Partner
http://GuruCE.com
Consultancy, training and development services.

curious1

unread,
Oct 20, 2008, 11:33:05 AM10/20/08
to
Thanks Michel for info.

One more thing please: seems like using SEC_COMMIT would not make much
difference in strictly memory mapped file (ones that are not backed by file
on disk). Is that correct ?

SEC_COMMIT info: http://msdn.microsoft.com/en-us/library/ms923951.aspx

SEC_COMMIT: Allocates physical storage in memory or in the paging file on
disk for all pages of a section. This is the default setting.

Michel Verhagen (eMVP)

unread,
Oct 20, 2008, 4:40:21 PM10/20/08
to
Yes, that is correct. It does exactly nothing (IMHO).

Good luck,

Michel Verhagen, eMVP
Check out my blog: http://GuruCE.com/blog

GuruCE
Microsoft Embedded Partner
http://GuruCE.com
Consultancy, training and development services.

0 new messages