aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_db_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator/beam/erl_db_util.c')
-rw-r--r--erts/emulator/beam/erl_db_util.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/erts/emulator/beam/erl_db_util.c b/erts/emulator/beam/erl_db_util.c
index 48e0080525..2f34561234 100644
--- a/erts/emulator/beam/erl_db_util.c
+++ b/erts/emulator/beam/erl_db_util.c
@@ -1733,8 +1733,7 @@ restart:
FAIL();
ep = termp;
break;
- case matchArrayBind: /* When the array size is unknown. */ /* XXX:PaN - where does
- this array come from? */
+ case matchArrayBind: /* When the array size is unknown. */
n = *pc++;
hp[n] = dpm_array_to_list(psp, termp, arity);
break;
@@ -2452,9 +2451,13 @@ void* db_get_term(DbTableCommon *tb, DbTerm* old, Uint offset, Eterm obj)
DbTerm* p;
Eterm copy;
Eterm *top;
+ ErlOffHeap tmp_offheap;
if (old != 0) {
- erts_cleanup_offheap(&old->off_heap);
+ tmp_offheap.first = old->first_oh;
+ tmp_offheap.overhead = 0;
+ erts_cleanup_offheap(&tmp_offheap);
+ old->first_oh = tmp_offheap.first;
if (size == old->size) {
p = old;
} else {
@@ -2490,11 +2493,12 @@ void* db_get_term(DbTableCommon *tb, DbTerm* old, Uint offset, Eterm obj)
p = (DbTerm*) ((void *)(((char *) structp) + offset));
}
p->size = size;
- p->off_heap.first = NULL;
- p->off_heap.overhead = 0;
+ tmp_offheap.first = NULL;
+ tmp_offheap.overhead = 0;
top = DBTERM_BUF(p);
- copy = copy_struct(obj, size, &top, &p->off_heap);
+ copy = copy_struct(obj, size, &top, &tmp_offheap);
+ p->first_oh = tmp_offheap.first;
DBTERM_SET_TPL(p,tuple_val(copy));
return structp;
@@ -2503,7 +2507,10 @@ void* db_get_term(DbTableCommon *tb, DbTerm* old, Uint offset, Eterm obj)
void db_free_term_data(DbTerm* p)
{
- erts_cleanup_offheap(&p->off_heap);
+ ErlOffHeap tmp_offheap;
+ tmp_offheap.first = p->first_oh;
+ tmp_offheap.overhead = 0;
+ erts_cleanup_offheap(&tmp_offheap);
}