[Python-Dev] mmapfile module

Fredrik Lundh fredrik@pythonware.com
Tue, 16 Nov 1999 20:32:21 +0100


> Hmm... I don't know of any way to use mmap() on non-file things,
> either; there are odd special cases, like using MAP_ANONYMOUS on
> /dev/zero to allocate memory, but that's still using a file.

but that's not always the case -- OSF/1 supports
truly anonymous mappings, for example.  in fact,
it bombs if you use ANONYMOUS with a file handle:

$ man mmap

    ...

    If MAP_ANONYMOUS is set in the flags parameter:

        +  A new memory region is created and initialized to all zeros.  This
           memory region can be shared only with descendents of the current pro-
           cess.

        +  If the filedes parameter is not -1, the mmap() function fails.

    ...

(btw, doing anonymous maps isn't exactly an odd special
case under this operating system; it's the only memory-
allocation mechanism provided by the kernel...)

</F>