0

I receive packets from dma in streaming mode (32 packets per call), I need to copy them to a file. When all dma buffer is full I use memcpy to take dma buffer to another ram buffer and another thread copy it to the file. But I realised memcpy decreases my speed (about 100MB/sn). It has to be upper 200MB/sn. My system is windows.

Any help would be appreciated.

pfdx44
  • 107
  • 1
  • 1
  • 8
  • `memcpy` is unlikely to decrease your speed. Why do you think it does? If you remove the `memcpy`, and just write garbage, how fast is that? – MSalters Jan 22 '15 at 11:52
  • when i write garbage it is very fast. but today i realised that the problem may be VirtualAlloc. Because when the source parameter of memcpy is buffer being allocated by VirtualAlloc is slow. – pfdx44 Jan 23 '15 at 12:03
  • Why are you even using `VirtualAlloc`? That's not the usual memory allocation function. – MSalters Jan 24 '15 at 14:37
  • Because of memory fragmentation. I solved the problem, PAGE_NOCACHE parameter was the reason. Now I am looking a way to write to file fastly , It never ends :). Thank you. – pfdx44 Jan 25 '15 at 09:54

0 Answers0