I am sharing a memory data between multiple processes as per design.
As per design the application requires multiple memory files, like each process requires one memory map file. But some processes needs less memory mapped file like it can be 10KB or less. and some processes required more than 1mb memory file. once the processes task over, then i will use the same memory mapped file for some other process.
In this scenario how i can increase the memory mapped file size based on the process request. Like once i create memory mapped file using CreateFileMapping. how i can increase the memory size or decrease the size.
also i have another sub question, how to clean this data without closing this memory mapped file. please share if any one knows.
thanks a lot in advance. hara
No - you can't increase the mapping after creation (see http://msdn.microsoft.com/en-us/library/windows/desktop/aa366537%28v=vs.85%29.aspx)!
The sizes you describe don't sound problematic so I would just go with one "big enough size".
To clean the data you can use for example memset ()
(see http://msdn.microsoft.com/en-us/library/1fdeehz6.aspx or http://www.cplusplus.com/reference/clibrary/cstring/memset/) or ZeroMemory()
(which is just a Windows API macro mapping to memset
).