Changeset: 053c3777c55b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=053c3777c55b
Modified Files:
monetdb5/extras/jaql/jaqlscenario.c
monetdb5/mal/mal_import.c
sql/backends/monet5/sql.mx
sql/backends/monet5/sql_scenario.c
Branch: default
Log Message:
Merged with Feb2013 branch.
diffs (141 lines):
diff --git a/monetdb5/extras/jaql/jaqlscenario.c
b/monetdb5/extras/jaql/jaqlscenario.c
--- a/monetdb5/extras/jaql/jaqlscenario.c
+++ b/monetdb5/extras/jaql/jaqlscenario.c
@@ -285,6 +285,7 @@ JAQLengine(Client c)
* workaround */
chkProgram(c->fdout, c->nspace, c->curprg->def);
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak */
c->glb = 0;
if (j->explain) {
printFunction(c->fdout, c->curprg->def, 0, LIST_MAL_STMT |
LIST_MAPI);
@@ -318,6 +319,7 @@ JAQLengine(Client c)
MSresetInstructions(c->curprg->def, 1);
freeVariables(c, c->curprg->def, c->glb, j->vtop);
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak */
c->glb = oldglb;
freetree(j->p);
diff --git a/monetdb5/mal/mal_import.c b/monetdb5/mal/mal_import.c
--- a/monetdb5/mal/mal_import.c
+++ b/monetdb5/mal/mal_import.c
@@ -145,6 +145,7 @@ malLoadScript(Client c, str name, bstrea
c->prompt = oldprompt; \
c->promptlength= (int)strlen(c->prompt);
#define restoreClient2 \
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak */ \
c->glb = oldglb; \
c->nspace = oldnspace; \
c->curprg = oldprg;
diff --git a/sql/backends/monet5/sql.mx b/sql/backends/monet5/sql.mx
--- a/sql/backends/monet5/sql.mx
+++ b/sql/backends/monet5/sql.mx
@@ -7708,6 +7708,7 @@ RAstatement(Client cntxt, MalBlkPtr mb,
int oldstop = cntxt->curprg->def->stop;
stmt *s;
char *msg;
+ MalStkPtr oldglb = cntxt->glb;
if (*opt)
rel = rel_optimizer(m, rel);
@@ -7725,6 +7726,8 @@ RAstatement(Client cntxt, MalBlkPtr mb,
resetMalBlk(cntxt->curprg->def, oldstop);
freeVariables(cntxt,cntxt->curprg->def, cntxt->glb,
oldvtop);
}
+ assert(cntxt->glb == 0 || cntxt->glb == oldglb); /* detect leak
*/
+ cntxt->glb = oldglb;
}
return msg;
}
diff --git a/sql/backends/monet5/sql_scenario.c
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1101,6 +1101,7 @@ SQLstatementIntern(Client c, str *expr,
sql_rel *r;
stmt *s;
int oldvtop, oldstop;
+ MalStkPtr oldglb = c->glb;
if (!m->sa)
m->sa = sa_create();
@@ -1117,6 +1118,8 @@ SQLstatementIntern(Client c, str *expr,
execute = 0;
if (!err)
continue;
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak
*/
+ c->glb = oldglb;
goto endofcompile;
}
@@ -1127,10 +1130,6 @@ SQLstatementIntern(Client c, str *expr,
* optimize and produce code.
* We don;t search the cache for a previous incarnation yet.
*/
- if (c->glb) {
- /* MSinitClientPrg clears c->glb, so free it here */
- _DELETE(c->glb);
- }
MSinitClientPrg(c,"user",nme);
oldvtop = c->curprg->def->vtop;
oldstop = c->curprg->def->stop;
@@ -1148,6 +1147,8 @@ SQLstatementIntern(Client c, str *expr,
MSresetInstructions(c->curprg->def, oldstop);
freeVariables(c,c->curprg->def, c->glb, oldvtop);
c->curprg->def->errors = 0;
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak
*/
+ c->glb = oldglb;
goto endofcompile;
}
/* generate MAL code */
@@ -1162,6 +1163,8 @@ SQLstatementIntern(Client c, str *expr,
freeVariables(c,c->curprg->def, c->glb, oldvtop);
c->curprg->def->errors = 0;
msg = createException(SQL, "SQLparser","Errors
encountered in query");
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak
*/
+ c->glb = oldglb;
goto endofcompile;
}
@@ -1199,11 +1202,16 @@ noexecution:
}
}
sqlcleanup(m, 0);
- if (!execute)
+ if (!execute) {
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak
*/
+ c->glb = oldglb;
goto endofcompile;
+ }
#ifdef _SQL_COMPILE
mnstr_printf(c->fdout, "#parse/execute result %d\n", err);
#endif
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak */
+ c->glb = oldglb;
}
/*
* We are done; a MAL procedure recides in the cache.
@@ -2061,6 +2069,7 @@ SQLengineIntern(Client c, backend *be)
if( m->emode == m_prepare)
goto cleanup_engine;
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak */
c->glb = 0;
be->language = 'D';
/*
@@ -2083,6 +2092,7 @@ cleanup_engine:
MSresetInstructions(c->curprg->def, 1);
freeVariables(c,c->curprg->def, c->glb, be->vtop);
be->language = oldlang;
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak
*/
c->glb = oldglb;
return SQLrecompile(c, be);
} else {
@@ -2123,6 +2133,7 @@ cleanup_engine:
* Any error encountered during execution should block further
processing
* unless auto_commit has been set.
*/
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak */
c->glb = oldglb;
return msg;
}
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list