Changeset: 1903a3ae2017 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1903a3ae2017
Modified Files:
        monetdb5/mal/mal_interpreter.mx
        monetdb5/mal/mal_resolve.mx
Branch: Dec2011
Log Message:

Somewhat hacky way of plugging a memory leak.
Internal BLOB variables were not cleaned up.  The proper way of doing
this requires interface changes which are not allowed here.


diffs (47 lines):

diff --git a/monetdb5/mal/mal_interpreter.mx b/monetdb5/mal/mal_interpreter.mx
--- a/monetdb5/mal/mal_interpreter.mx
+++ b/monetdb5/mal/mal_interpreter.mx
@@ -2438,9 +2438,7 @@ void garbageElement(Client cntxt, ValPtr
                        v->val.sval = NULL;
                }
                v->len = 0;
-               return;
-       }
-       if (v->vtype == TYPE_bat) {
+       } else if (v->vtype == TYPE_bat) {
                /*
                 * @-
                 * All operations are responsible to properly set the
@@ -2462,6 +2460,8 @@ void garbageElement(Client cntxt, ValPtr
                if (cntxt && cntxt->flags & bigfootFlag)
                        updateBigFoot(cntxt, bid, FALSE);
                BBPdecref(bid, TRUE);
+       } else if (strcmp(BATatoms[v->vtype].name, "blob") == 0) {
+               GDKfree(v->val.pval);
        }
 }
 /*
diff --git a/monetdb5/mal/mal_resolve.mx b/monetdb5/mal/mal_resolve.mx
--- a/monetdb5/mal/mal_resolve.mx
+++ b/monetdb5/mal/mal_resolve.mx
@@ -529,7 +529,8 @@ findFunctionType(Module scope, MalBlkPtr
                isaBatType(@1) ||
                findGDKtype(@1) == TYPE_str ||
                (!isPolyType(@1) && @1 < TYPE_any &&
-                @1 >= 0 && ATOMstorage(@1) == TYPE_str)) {
+                @1 >= 0 && (ATOMstorage(@1) == TYPE_str ||
+                                        strcmp(BATatoms[@1].name, "blob") == 
0))) {
                getInstrPtr(@3, 0)->gc |= GARBAGECONTROL;
                setVarCleanup(mb, getArg(p, @2));
                p->gc |= GARBAGECONTROL;
@@ -783,7 +784,9 @@ void typeChecker(Module scope, MalBlkPtr
                int tpe = getArgType(mb,p,k);
                if (findGDKtype(tpe) == TYPE_bat ||
                        findGDKtype(tpe) == TYPE_str ||
-                       (!isPolyType(tpe) && tpe< TYPE_any && ATOMstorage(tpe) 
== TYPE_str))
+                       (!isPolyType(tpe) && tpe< TYPE_any &&
+                        (ATOMstorage(tpe) == TYPE_str ||
+                         strcmp(BATatoms[tpe].name, "blob") == 0)))
                        setVarCleanup(mb,getArg(p,k));
        }
 }
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to