Changeset: 2727702e548b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2727702e548b
Modified Files:
        MonetDB5/src/mal/mal_interpreter.mx
        MonetDB5/src/mal/mal_stack.mx
Branch: Oct2010
Log Message:

When you have MAL plans with 500k lines of code mserver crashes at the memset 
after newStack.
This function is only called in one place and followed by a memset. Therefore, 
the alloca + memset
can be replaced by a zalloc.

The structure is free in the end of the function call before the return.


diffs (32 lines):

diff -r 5ac9bc70ca0d -r 2727702e548b MonetDB5/src/mal/mal_interpreter.mx
--- a/MonetDB5/src/mal/mal_interpreter.mx       Wed Sep 15 15:45:09 2010 +0200
+++ b/MonetDB5/src/mal/mal_interpreter.mx       Wed Sep 15 15:47:32 2010 +0200
@@ -271,7 +271,6 @@
                pci= pcicaller;
        } else {
                newStack(stk,mb->vsize);
-               memset((char *) stk, 0, stackSize(mb->vsize));
                stk->stktop= mb->vtop; 
                stk->stksize= mb->vsize;
                stk->blk= mb;
@@ -344,6 +343,8 @@
        if ( !stk->keepAlive && garbageControl(getInstrPtr(mb,0)) )
                garbageCollector(cntxt, mb,stk, env != stk);
        @:endProfile(stk)@
+       if (stk)
+               GDKfree(stk);
        return ret;
 }
 @-
diff -r 5ac9bc70ca0d -r 2727702e548b MonetDB5/src/mal/mal_stack.mx
--- a/MonetDB5/src/mal/mal_stack.mx     Wed Sep 15 15:45:09 2010 +0200
+++ b/MonetDB5/src/mal/mal_stack.mx     Wed Sep 15 15:47:32 2010 +0200
@@ -104,7 +104,7 @@
 } MalStack, *MalStkPtr;
 
 #define stackSize(CNT) (sizeof(ValRecord)*(CNT) + sizeof(MalStack))
-#define newStack(S,CNT) S= (MalStkPtr) alloca(stackSize(CNT));\
+#define newStack(S,CNT) S= (MalStkPtr) GDKzalloc(stackSize(CNT));\
                (S)->stksize=CNT;
 
 
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to