Just curious if I'm creating a shared memory array on Windows platform like so:
HANDLE hFile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE | SEC_COMMIT, 0, 1024 * 4, _T("mySharedMemName"));
if(hFile)
{
VOID* pData = MapViewOfFile(hFile, FILE_MAP_ALL_ACCESS, 0, 0, 1024 * 4);
//Is 'pData' array initialized with zeros the first time the 'hFile' is used?
}
Is the memory array initialized with 0's the first time I call this code snippet? And if no, how to make it zero initialized?
From the documentation:
The initial contents of the pages in a file mapping object backed by the operating system paging file are 0 (zero).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With