Changeset: b36537c033c2 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b36537c033c2
Modified Files:
        monetdb5/mal/mal_factory.c
        monetdb5/mal/mal_interpreter.c
Branch: Jun2016
Log Message:

Memory leak.


diffs (49 lines):

diff --git a/monetdb5/mal/mal_factory.c b/monetdb5/mal/mal_factory.c
--- a/monetdb5/mal/mal_factory.c
+++ b/monetdb5/mal/mal_factory.c
@@ -382,13 +382,12 @@ void mal_factory_reset(void)
                        /* MSresetVariables(mb, pl->stk, 0);*/
                        /* freeStack(pl->stk); there may be a reference?*/
                        /* we are inside the body of the factory and about to 
return */
-                       pl->factory = 0;
-                       if (pl->stk)
+                       if (pl->stk) {
                                pl->stk->keepAlive = FALSE;
-                       if ( pl->stk) {
-                               //garbageCollector(cntxt, mb, pl->stk,TRUE);
+                               garbageCollector(NULL, pl->factory, 
pl->stk,TRUE);
                                GDKfree(pl->stk);
                        }
+                       pl->factory = 0;
                        pl->stk=0;
                        pl->pc = 0;
                        pl->inuse = 0;
diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -1431,8 +1431,10 @@ void garbageCollector(Client cntxt, MalB
        ValPtr v;
 
 #ifdef STACKTRACE
-       mnstr_printf(cntxt->fdout, "#--->stack before garbage collector\n");
-       printStack(cntxt->fdout, mb, stk, 0);
+       if (cntxt) {
+               mnstr_printf(cntxt->fdout, "#--->stack before garbage 
collector\n");
+               printStack(cntxt->fdout, mb, stk, 0);
+       }
 #endif
        for (k = 0; k < mb->vtop; k++) {
                if (isVarCleanup(mb, k) && (flag || isTmpVar(mb, k))) {
@@ -1442,8 +1444,10 @@ void garbageCollector(Client cntxt, MalB
                }
        }
 #ifdef STACKTRACE
-       mnstr_printf(cntxt->fdout, "#-->stack after garbage collector\n");
-       printStack(cntxt->fdout, mb, stk, 0);
+       if (cntxt) {
+               mnstr_printf(cntxt->fdout, "#-->stack after garbage 
collector\n");
+               printStack(cntxt->fdout, mb, stk, 0);
+       }
 #else
        (void)cntxt;
 #endif
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to