Update of /cvsroot/monetdb/MonetDB4/src/modules/plain
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv8206

Modified Files:
      Tag: GDK-2
        bat.mx 
Log Message:
Fix size manipulations.


Index: bat.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB4/src/modules/plain/bat.mx,v
retrieving revision 1.15.2.6
retrieving revision 1.15.2.7
diff -u -d -r1.15.2.6 -r1.15.2.7
--- bat.mx      15 Aug 2007 09:37:31 -0000      1.15.2.6
+++ bat.mx      15 Aug 2007 15:51:45 -0000      1.15.2.7
@@ -2003,8 +2003,7 @@
        bn->tsorted = 0;
        bn->tkey = 0;
        bn->batRestricted = BAT_READ;
-       BATsetcount(bn, n = (cnt << REMAP_PAGE_BITS));
-       n = tailsize(b,n);
+       n = cnt << REMAP_PAGE_BITS;
 
        /* copy the entire tail heap (if present) */
        if (ATOMvarsized(bn->ttype)) {
@@ -2017,26 +2016,29 @@
        /* try to get a reserved mmap region */
        if (mmappath) {
                void *base;
+               size_t heapsize = tailsize(bn, n);
+
                if (bn->T->heap.filename)
                        GDKfree(bn->T->heap.filename); 
                bn->T->heap.filename = GDKstrdup(b->T->heap.filename); 
                if (bn->T->heap.filename == NULL)
                        goto error;
                 GDKfilepath(mmappath, BATDIR, bn->T->heap.filename, NULL);
-               base = MT_mmap_open(&hdl, mmappath, mode, 0, n, cnt);
+               base = MT_mmap_open(&hdl, mmappath, mode, 0, heapsize, cnt);
                if (base == (void*) -1) goto error;
 
                bn->T->heap.base = base;
-               bn->T->heap.size = bn->T->heap.maxsize = n; 
+               bn->T->heap.size = bn->T->heap.maxsize = heapsize; 
                bn->T->heap.storage = STORE_MMAP;
                if (!*force)
                        bn->T->heap.storage |= STORE_PRIV; 
-       } else if (HEAPalloc(&bn->T->heap, n, 1) < 0) {
+       } else if (HEAPalloc(&bn->T->heap, n, Tsize(bn)) < 0) {
                goto error;
        }
 
        /* set the right bat size */
-       bn->T->heap.free = n;
+       bn->batCapacity = n;
+       BATsetcount(bn, n);
        bn->batFirst = bn->batDeleted = 0;
        bn->batInserted = (cnt << REMAP_PAGE_BITS);
 
@@ -2054,7 +2056,7 @@
        }
        if (mmappath) {
                MT_mmap_close(&hdl);
-               GDKvminc(n);
+               GDKvminc(tailsize(bn, n));
        }
 
        /* if the tail atom has refcounting, we must fix the copies */


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to