Changeset: 2f4b1b69510e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2f4b1b69510e
Modified Files:
        monetdb5/mal/mal_instruction.c
Branch: Dec2016
Log Message:

fix concurrency problem, do not keep array of Symbols, simply use malloc (which 
is thread safe), were a  'a = b++' isn't atomic.


diffs (41 lines):

diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -16,10 +16,6 @@
 #include "mal_utils.h"
 #include "mal_exception.h"
 
-#define MAXSYMBOLS 12000 /* enough for the startup and some queries */
-static SymRecord symbolpool[MAXSYMBOLS];
-static int symboltop;
-
 Symbol
 newSymbol(str nme, int kind)
 {
@@ -29,13 +25,9 @@ newSymbol(str nme, int kind)
                GDKerror("newSymbol:unexpected name (=null)\n");
                return NULL;
        }
-       if( symboltop < MAXSYMBOLS){
-               cur = symbolpool + symboltop++;
-       } else {
-               cur = (Symbol) GDKzalloc(sizeof(SymRecord));
-               if (cur == NULL)
-                       return NULL;
-       }
+       cur = (Symbol) GDKzalloc(sizeof(SymRecord));
+       if (cur == NULL)
+               return NULL;
        cur->name = putName(nme);
        cur->kind = kind;
        cur->peer = NULL;
@@ -56,8 +48,7 @@ freeSymbol(Symbol s)
                freeMalBlk(s->def);
                s->def = NULL;
        }
-       if( !( s >= symbolpool && s < symbolpool + MAXSYMBOLS))
-               GDKfree(s);
+       GDKfree(s);
 }
 
 void
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to