mmap caching
Laszlo Nagy
gandalf at designaproduct.biz
Mon Jan 22 15:18:35 EST 2007
> In fact, memory that is read in because of mmap should *never* cause
> a MemoryError.
This is certainly not true. You can run out of virtual address space by
reading data from a memory mapped file.
> 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.
>
Hmm, maybe I'm wrong. Are you sure that Windows allocates the size of
the whole file in terms of memory address space? I also wrote a program
before (in Delphi). That program was playing a memory mapped wave file.
From the task manager, I have seen that "used memory" was growing as
the program was playing the wave file. For me, this indicates that
Windows extends the mapped address space in chunks.
Regards,
Laszlo
More information about the Python-list
mailing list