Hi Phillip. I appreciate your reply. I think perhaps I will need to
create a new mmap as a work around and write to locations of the
second mmap based on my regex searches in the first. I should have
said I am using 2.5.4 as well to be clear. I am wondering if I should
recommend change to documentation for mmap if this is an issue for
OSX. I have vmware installed so might try on CentOS to see what
happens there. Many thanks
Regards,
David
On 5-Apr-09, at 11:34 AM, Philip Semanchuk wrote:
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
--
http://mail.python.org/mailman/listinfo/python-list