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