mmap caching

Nick Craig-Wood nick at craig-wood.com
Mon Jan 22 04:30:06 EST 2007


Martin v. Löwis <martin at v.loewis.de> wrote:
>  In fact, memory that is read in because of mmap should *never* cause
>  a MemoryError. Python calls MapViewOfFile when mmap.mmap is invoked,
>  at which point the operating commits to providing that much address
>  space to the application, along with backing storage on disk
>  (typically, from the file being mapped, unless it is an anonymous
>  map). Later access to the mapped range cannot fail (except for
>  hardware errors), and if it would, you wouldn't see a MemoryError.

So presumably it is python generating a MemoryError.  It is asking for
a new bit of memory and it is failing so it throws a MemoryError.

Could memory allocation under windows be affected by a large chunk of
mmap()ed file which is physically swapped in at the time of the
allocation?

-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick



More information about the Python-list mailing list