Re: Interprocess Communication & Performance



I would go for a shared file mapping - you eliminate lots of memcpy's that
way.

(Just because it is "pagefile backed" doesn't mean that it will be
continually paged out - think of it like any other VM you allocate, which
might be paged out if the system is under memory pressure or it becomes
unused for an extended period of time.)

"Jos Scherders" <thrower@xxxxxxx> wrote in message
news:%23y%23%230ohRGHA.5908@xxxxxxxxxxxxxxxxxxxxxxx
Hi,

I know these API's, they are all documented in
MSDN, but that does not answer the question.
The question is, is allocating and mapping
allocated memory myself faster then using the
file mapping stuf or is not worth the trouble. My
thought was that avoiding flushing memory to the
swap file and reading it back could be avoided and
therefore would be faster.

Any idea's ?

Jos.

"Kellie Fitton" <KELLIEFITTON@xxxxxxxxx> wrote in message
news:1142119554.874839.157820@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,

Use the following APIs to allocate memory in the address space
of another process:

VirtualAllocEx()
VirtualFreeEx()

Additionally, you can use he following APIs to create shared
memory in IPC:

CreateFileMapping()
OpenFileMapping()
MapViewOfFileEx()
UnmapViewOfFile()
FlushViewOfFile()

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/virtualallocex.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/virtualfreeex.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/createfilemapping.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/openfilemapping.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/mapviewoffileex.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/unmapviewoffile.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/flushviewoffile.asp

Hope these suggestions helps,

Kellie.





.



Relevant Pages

  • Re: Interprocess Communication & Performance
    ... For instance if the data items are small and ... memory the performance hit from the synchronization will overwhelm things. ... to map the allocated memory in both processes. ... memcpy's then using shared file mapping I think. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: similar Perl data structure?
    ... One big difference between the two versions is the user of your C function has to remember to free all the allocated memory. ... Memory is just one of the resources a programme has to manage. ... Using platform specifics (file mapping) probably yes. ...
    (comp.lang.c)
  • Re: How to share object between processes?
    ... Sharing Files and Memory ... File mapping can be used to share a file or memory between two or more ... CreateFileMapping function, specifying the file handle and a name for the ... CreateFileMapping and OpenFileMapping functions fail if they specify a name ...
    (microsoft.public.vc.mfc)
  • Re: Memory mapped file pages getting cleared when memory overcommi
    ... File mapping object keeps a reference to the FILE_OBJECT, ... I have a win32 program running on XP Pro that is using a memory mapped ...
    (microsoft.public.win32.programmer.kernel)
  • Re: How to take in a string of any size?
    ... >the contents into the allocated memory. ... nobody said the string started at the beginning of the file. ... >number of calls to realloc() isn't going to be excessive). ...
    (comp.lang.c)