[Monetdb-developers] mmap region resizing

Isidor Zeuner monetdb at quidecco.de
Tue Jan 26 03:59:08 CET 2010

While figuring out some things related to memory management, I
stumbled upon a line in MonetDB/src/gdk/gdk_posix.mx which I don't
fully understand:

munmap(p + oldsize, oldsize - newsize);

..which is called from MT_vmrealloc when the old size is larger than
the new size. This would unmap a region as large as the size
difference between both sizes, but after the currently mapped region
[p; p + oldsize[ (which is probably not mapped, or is mapped to
something unrelated). The attached patch changes this behavior so the
resulting mapped region will be [p; p + newsize[, with the now
unneeded [p + newsize; p + oldsize[ region being unmapped (which is a
behavior I find more intuitive).

Please review and use as it fits.

Best regards,

Isidor Zeuner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MonetDB-realloc.diff
Type: text/x-patch
Size: 374 bytes
Desc: not available
URL: <http://www.monetdb.org/pipermail/developers-list/attachments/20100126/0a6bb653/attachment.bin>

More information about the developers-list mailing list