aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_db.h
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2018-09-27 16:07:10 +0200
committerSverker Eriksson <[email protected]>2018-10-03 19:00:53 +0200
commitd88239752cdeacfac8858439334599b3ec471803 (patch)
tree8ffd956327a28e68e0f41afd6ab75ad4d2a55135 /erts/emulator/beam/erl_db.h
parent4a67d1a104193ca0f5a0dc3f3dfc0e2b6df61f2f (diff)
downloadotp-d88239752cdeacfac8858439334599b3ec471803.tar.gz
otp-d88239752cdeacfac8858439334599b3ec471803.tar.bz2
otp-d88239752cdeacfac8858439334599b3ec471803.zip
erts: Improve deallocation of CATree nodes
Update table memory stats before scheduling free to not be dependent on deallocation order with main table struct.
Diffstat (limited to 'erts/emulator/beam/erl_db.h')
-rw-r--r--erts/emulator/beam/erl_db.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_db.h b/erts/emulator/beam/erl_db.h
index 45d120ac0e..7a915ccea2 100644
--- a/erts/emulator/beam/erl_db.h
+++ b/erts/emulator/beam/erl_db.h
@@ -286,6 +286,12 @@ ERTS_GLB_INLINE void erts_db_free(ErtsAlcType_t type,
void *ptr,
Uint size);
+ERTS_GLB_INLINE void erts_schedule_db_free(DbTableCommon* tab,
+ void (*free_func)(void *),
+ void *ptr,
+ ErtsThrPrgrLaterOp *lop,
+ Uint size);
+
ERTS_GLB_INLINE void erts_db_free_nt(ErtsAlcType_t type,
void *ptr,
Uint size);
@@ -306,6 +312,26 @@ erts_db_free(ErtsAlcType_t type, DbTable *tab, void *ptr, Uint size)
}
ERTS_GLB_INLINE void
+erts_schedule_db_free(DbTableCommon* tab,
+ void (*free_func)(void *),
+ void *ptr,
+ ErtsThrPrgrLaterOp *lop,
+ Uint size)
+{
+ ASSERT(ptr != 0);
+ ASSERT(((void *) tab) != ptr);
+ ASSERT(size == ERTS_ALC_DBG_BLK_SZ(ptr));
+
+ /*
+ * We update table memory stats here as table may already be gone
+ * when 'free_func' is finally called.
+ */
+ ERTS_DB_ALC_MEM_UPDATE_((DbTable*)tab, size, 0);
+
+ erts_schedule_thr_prgr_later_cleanup_op(free_func, ptr, lop, size);
+}
+
+ERTS_GLB_INLINE void
erts_db_free_nt(ErtsAlcType_t type, void *ptr, Uint size)
{
ASSERT(ptr != 0);