Changeset: a7a1d160235d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a7a1d160235d
Modified Files:
        gdk/gdk_heap.c
Branch: Jul2021
Log Message:

After string offset heap upgrade, if no other refs, free memory.


diffs (16 lines):

diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -528,7 +528,11 @@ GDKupgradevarheap(BAT *b, var_t v, BUN c
        b->theap = new;
        if (BBP_status(bid) & (BBPEXISTING|BBPDELETED) && BATgetprop_nolock(b, 
(enum prop_t) 21) == NULL) {
                BATsetprop_nolock(b, (enum prop_t) 21, TYPE_ptr, &old);
-               ATOMIC_OR(&old->refs, DELAYEDREMOVE);
+               if ((ATOMIC_OR(&old->refs, DELAYEDREMOVE) & HEAPREFS) == 1) {
+                       /* we have the only reference, we can free the
+                        * memory */
+                       HEAPfree(old, false);
+               }
        } else {
                ValPtr p = BATgetprop_nolock(b, (enum prop_t) 20);
                HEAPdecref(old, p == NULL || strcmp(((Heap*) 
p->val.pval)->filename, old->filename) != 0);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to