Home > Back-end >  The memory mapping problem
The memory mapping problem

Time:10-19

Use MapViewOfFile mapping file, the file size is about 1 g, the vc can direct mapping, success under BC GetLastError error under 8, make use of the maximum continuous query VirtualQuery currently available virtual memory space, vc 1.7 g, BC under 700 m or so, so can't mapping, 32-bit system the process of the user address space is not 2 g? So why not BC?
In addition, the use of smaller blocks to circular mapping data, such as video data, how to deal with the data between the two pieces? Video data each frame size is not fixed, but a 64 k memory mapping are integer times,

CodePudding user response:

Placed behind or in front of the two pieces of a piece of data used to copy of the video frames, to ensure that the subsequent processing can be a complete video frames

CodePudding user response:

In each virtual memory increases in the first paragraph of a data structure that is used to store the current virtual memory size of the valid data in a
Loop reads the first read the first paragraph within the data structure of data, and then the subsequent data using the memcpy function connects the data between different block
Here is my train of thought:

=0, int ii nBlockSize=5, nVirtalLen=0, nBuffLen=0; 
Void * pVirtalPtr=NULL;
Void * pBuff1G=malloc (1024 * 1024 * 1024);
For (ii=0; Ii{
PVirtalPtr=MapViewOfFile... ;
NVirtalLen=* ((int *) pVirtalPtr);
Memcpy (pBuff1G + nBuffLen (char *), (int *) pVirtalPtr + 1, nVirtalLen);
NBuffLen +=nVirtalLen;
}
  • Related