[New-bugs-announce] [issue5282] mmap.resize and offset

Hirokazu Yamamoto report at bugs.python.org
Mon Feb 16 18:22:56 CET 2009


New submission from Hirokazu Yamamoto <ocean-city at m2.ccsnet.ne.jp>:

This is first time to look at mmap module, so sorry if I'm saying
totally wrong thing. (I noticed this when I saw issue2733) I think the
behavior of mmap_resize_method is unclear when mapping object is created
with offset > 0.

>From view of other functions, it seems that self->offset is offset from
beginning of the file, and self->size is the size of mapped area from
self->offset. If so,

#if SIZEOF_SIZE_T > 4
    newSizeHigh = (DWORD)((self->offset + new_size) >> 32);
    newSizeLow = (DWORD)((self->offset + new_size) & 0xFFFFFFFF);
#else
    newSizeHigh = 0;
    newSizeLow = (DWORD)new_size; /* shouldn't add self->offset? this is
not doing same thing as SIZEOF_SIZE_T > 4 */
#endif

And on unix part,
    newmap = mremap(self->data, self->size, new_size, MREMAP_MAYMOVE);
self->offset is totally ignored. I think when self->offset > 0,
something wrong happens.

And comment above function definition saids,

 / Is this really necessary?  This could easily be done
 / from python by just closing and re-opening with the
 / new size?

I think this function is not tested well. There is no test about
resize+offset in test_mmap.py.

----------
components: Extension Modules
messages: 82253
nosy: ocean-city
severity: normal
status: open
title: mmap.resize and offset
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5282>
_______________________________________


More information about the New-bugs-announce mailing list