Memory mapped File (Python win32 extensions)

Thomas Heller theller at python.net
Thu Mar 17 20:16:36 CET 2005


"Srijit Kumar Bhadra" <srijit at yahoo.com> writes:

> Hello,
> I see that it is possible to use mmapfile.pyd of win32all. The same is
> mentioned in http://www.python.org/windows/win32/#mmapfile.
>
> Unfortunately I could not trace any example using mmapfile.
>
> Any example or link to an example will be of help. I am interested to
> learn how to achieve efficient sharing of data between separate
> processes using mmapfile.

You can even create a shared memory mapped file for sharing data
between processes on Windows in pure Python.  It's not really obvious
from the mmap description, but calling

   shmem = mmap.mmap(0, 32000, "spam")

creates (or opens, if it already exists) a shared memory block,
not based an any existing file.  In other words, the fileno (first
parameters) must be 0, and the last one specifies the system wide name
of the shared memory block.

Thomas



More information about the Python-list mailing list