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
diff -uNr MonetDB.orig/src/gdk/gdk_posix.mx MonetDB/src/gdk/gdk_posix.mx
--- MonetDB.orig/src/gdk/gdk_posix.mx
+++ MonetDB/src/gdk/gdk_posix.mx
@@ -2078,7 +2078,7 @@
 	}
 
 	if (oldsize > newsize) {
-		munmap(p + oldsize, oldsize - newsize);
+		munmap(p + newsize, oldsize - newsize);
 	} else if (oldsize < newsize) {
 		if (newsize < oldmaxsize) {
 			MMAP_OPEN_DEV_ZERO;
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Monetdb-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-developers

Reply via email to