file-mapping

How to load (or map) file part maximum size, but fit in RAM on Windows?

冷暖自知 提交于 2021-02-05 12:21:02
问题 There is big file. I need fast sort it. I going to process the file by part, that fit in RAM, to avoid/degrees using page file (next step: merge parts). How to use max RAM? My solution: use WinApi file memory mapping, but I don't knew how to get part of file maximum size, but fit RAM (how to determine size)? 回答1: You can VirtualLock the pages you want to process. It locks in physical memory the size you need (if there is enough) swapping others to the paging file. You can use the

How to load (or map) file part maximum size, but fit in RAM on Windows?

|▌冷眼眸甩不掉的悲伤 提交于 2020-07-23 06:22:23
问题 There is big file. I need fast sort it. I going to process the file by part, that fit in RAM, to avoid/degrees using page file (next step: merge parts). How to use max RAM? My solution: use WinApi file memory mapping, but I don't knew how to get part of file maximum size, but fit RAM (how to determine size)? 回答1: You can VirtualLock the pages you want to process. It locks in physical memory the size you need (if there is enough) swapping others to the paging file. You can use the

How to load (or map) file part maximum size, but fit in RAM on Windows?

情到浓时终转凉″ 提交于 2020-07-23 06:20:42
问题 There is big file. I need fast sort it. I going to process the file by part, that fit in RAM, to avoid/degrees using page file (next step: merge parts). How to use max RAM? My solution: use WinApi file memory mapping, but I don't knew how to get part of file maximum size, but fit RAM (how to determine size)? 回答1: You can VirtualLock the pages you want to process. It locks in physical memory the size you need (if there is enough) swapping others to the paging file. You can use the

Using file mapping in different sessions on Windows

陌路散爱 提交于 2020-07-09 12:01:31
问题 I using CreateFileMapping and MapViewOfFile to use a file as Shared storage between two process. The process A, it is running as Service in session 0, to clear the content in file mapping. The process B, it is a normal process run in session 1, to read and write the content in file mapping. Using process B first, there has some data were stored into file mapping and terminates. Then, run the Process A to clear data. In my expectation, after execute process A, the file mapping would become

how to create a share memory pool in windows

女生的网名这么多〃 提交于 2020-01-07 02:32:05
问题 I want to make a share memory pool for all the other process to share the data, but after I read about the CreateFileMapping API document, I was confused about that it will need to specify the size of the share memory. I actually want it to be dynamic allocate and free which looks more like a service. Is there some way to do the share memory dynamic using createFileMapping or not? 回答1: Creating Named Shared Memory. First Process The first process creates the file mapping object by calling the

Communication using Shared Memory between VC++ and Qt applications

时光总嘲笑我的痴心妄想 提交于 2020-01-06 20:01:36
问题 I am using FileMapping for implementing shared memory concept in a C++ windows form application and QSharedMemory in Qt application. I want to read data written by C++ form application using FileMapping technique, in Qt application using QsharedMemory. Is it possible? If not please suggest appropriate methods to implement this feature. 回答1: I'm not quite sure of the detail of your implementation, however I would suggest that a better more uniform way to approach this would be by using boost:

How to send vector<vector<type>> via MapViewOfFile

白昼怎懂夜的黑 提交于 2019-12-25 08:58:00
问题 I have the following code in a parent process: vector<vector<double> > matrix(n); /* matrix NxM */ /* pushing data */ HANDLE hMapping = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, 2*sizeof(int) + sizeof(double)*n*m, lpName); LPVOID lp = MapViewOfFile(hMapping, FILE_MAP_WRITE, 0, 0, 0); mat_tmp* tmp = (mat_tmp*)lp; tmp->n = n; tmp->m = m; tmp->vv = vector<vector<double> >(matrix.begin(), matrix.end()); In a child process I'm trying to receive this vector >, but my child

Windows API: find process for a file mapping handle

隐身守侯 提交于 2019-12-23 03:09:18
问题 I created an SSH agent (similar to PuTTY's pageant.exe) which has a predefined protocol: Authentication requests are sent to the agent window via WM_COPYDATA containing the name of a file mapping: // mapname is supplied via WM_COPYDATA HANDLE filemap = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, mapname); Is it possible to find out which process (ultimatively, the process name) created a particular file mapping? I can use GetSecurityInfo on "filemap" to get the security attributes (SID, GID,

CreateFileMapping, MapViewOfFile, handle leaking c++

人盡茶涼 提交于 2019-12-12 16:09:19
问题 Background: I am trying to create a memory mapped file that can be accessed by multiple processes. In the below code I only put in the code that pertains to the question I currently have to make things simpler. According to msdn I should be able to create a filemap, map the view of the file and close the handle I received from CreateFileMapping and the MapViewOfFile will keep my FileMap alive. The FileMap should be still accessible until I UnmapViewOfFile. MSDN: CreateFileMapping function

How can I decommit a file-mapped page?

冷暖自知 提交于 2019-12-09 20:24:36
问题 I have a memory mapped file, and a page in a view which is currently committed. I would like to decommit it. MapViewOfFile tells me I cannot use VirtualFree on file mapped pages. Is there some other way to do it? 回答1: You cannot decommit it, but what you really want is not decommitting it ... What you really want is to release the page from a memory. This can be done by using VirtualUnlock. See VirtualUnlock Remarks: Calling VirtualUnlock on a range of memory that is not locked releases the