On Apr 5, 2009, at 10:28 AM, David Pratt wrote:
Hi. I have been experimenting with mmap recently. I determined how
to read and write properly from it and so search and replace on
large files. The problem I am having is with replaces that are
larger than the mmap. In this instance I need to
* rewind
* resize the mmap to accomodate the text
* move some part of the text to a new location on the mmap so the
new text does not overwrite the old
* write the replacement text
When I try to use resize it gives me the following error;
SystemError: mmap: resizing not available--no mremap()
Hi David,
Based on experience with my posix_ipc module, ISTR that (a) resizing
of the mmapp-ed segment happens via a call to ftruncate() (or
os.truncate() in Python land) and (b) OS X only supports one call to
this per segment; subsequent calls fail. Keep in mind that I was
dealing with shared memory. A regular mmapped file might resize just
fine so point (b) might be irrelevant for you.
HTH
Philip
--
http://mail.python.org/mailman/listinfo/python-list