tmighty
tmighty

Reputation: 11415

C++: Find bottleneck with memory mapped files

I have memory-mapped a file and I get data from it using MemCpy. Sometimes it is lightening fast, and sometimes surprisingly slow. For example: Once 0.15 milliseconds, then the same operation 6 seconds.

I am not sure where the bottleneck is or how to resolve it.

I think I will therefore need to do some rather "deep" analysis to find out what exactely makes the MemCpy operation so slow sometimes.

Can somebody suggest what I should do to track the problem?

Upvotes: 2

Views: 175

Answers (1)

sehe
sehe

Reputation: 393944

I think you may want to use

  • VirtualLock

    Locks the specified region of the process's virtual address space into physical memory, ensuring that subsequent access to the region will not incur a page fault.

  • VirtualUnlock

There's a background page Working with Pages that lists and describes more relevant API calls.

Upvotes: 2

Related Questions