Changeset: 745ff1012a26 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=745ff1012a26
Modified Files:
gdk/gdk_heap.c
Branch: Feb2013
Log Message:
Make sure the whole heap gets copied if that's what we want.
When going from malloced to mmapped heap memory, HEAPextend only
copies what it says in the free field. When GDKupgradevarheap needs
to copy everything (copyall is set), we need to temporarily set free
to the size of the whole heap.
This fixes bug 3261, and presumably also bu 3268.
diffs (25 lines):
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -487,6 +487,7 @@ GDKupgradevarheap(COLrec *c, var_t v, in
var_t *pv;
#endif
size_t i, n;
+ size_t savefree;
assert(c->heap.parentid == 0);
assert(width != 0);
@@ -503,8 +504,13 @@ GDKupgradevarheap(COLrec *c, var_t v, in
* free value at the end; otherwise only copy the area
* indicated by the "free" pointer */
n = (copyall ? c->heap.size : c->heap.free) >> c->shift;
+ savefree = c->heap.free;
+ if (copyall)
+ c->heap.free = c->heap.size;
if (HEAPextend(&c->heap, (c->heap.size >> c->shift) << shift) < 0)
return GDK_FAIL;
+ if (copyall)
+ c->heap.free = savefree;
/* note, cast binds more closely than addition */
pc = (unsigned char *) c->heap.base + n;
ps = (unsigned short *) c->heap.base + n;
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list