aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_alloc_util.c
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2011-02-28 11:44:35 +0100
committerMicael Karlberg <[email protected]>2011-02-28 11:44:35 +0100
commit26eae94979083f6ae272b76589bce256b792e487 (patch)
tree1ac07672c29efd352f2009908c1b441a31b74c24 /erts/emulator/beam/erl_alloc_util.c
parent9671856faa243ee4567f4059fba28fd85b5d9baa (diff)
parente170c7f2ce8e0ac2cd45c922afc138305ca34b79 (diff)
downloadotp-26eae94979083f6ae272b76589bce256b792e487.tar.gz
otp-26eae94979083f6ae272b76589bce256b792e487.tar.bz2
otp-26eae94979083f6ae272b76589bce256b792e487.zip
Merge branch 'dev' into bmk/megaco/miscellaneous_dialyzer/OTP-9075
Had to fix a bunch of CopyRight end-dates (in erts files)...
Diffstat (limited to 'erts/emulator/beam/erl_alloc_util.c')
-rw-r--r--erts/emulator/beam/erl_alloc_util.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_alloc_util.c b/erts/emulator/beam/erl_alloc_util.c
index 8b184899c9..c09f0bbd77 100644
--- a/erts/emulator/beam/erl_alloc_util.c
+++ b/erts/emulator/beam/erl_alloc_util.c
@@ -3368,6 +3368,38 @@ erts_alcu_test(unsigned long op, unsigned long a1, unsigned long a2)
* Debug functions *
\* */
+void
+erts_alcu_verify_unused(Allctr_t *allctr)
+{
+ UWord no;
+
+ no = allctr->sbcs.curr_mseg.no;
+ no += allctr->sbcs.curr_sys_alloc.no;
+ no += allctr->mbcs.blocks.curr.no;
+
+ if (no) {
+ UWord sz = allctr->sbcs.blocks.curr.size;
+ sz += allctr->mbcs.blocks.curr.size;
+ erl_exit(ERTS_ABORT_EXIT,
+ "%salloc() used when expected to be unused!\n"
+ "Total amount of blocks allocated: %bpu\n"
+ "Total amount of bytes allocated: %bpu\n",
+ allctr->name_prefix, no, sz);
+ }
+}
+
+void
+erts_alcu_verify_unused_ts(Allctr_t *allctr)
+{
+#ifdef USE_THREADS
+ erts_mtx_lock(&allctr->mutex);
+#endif
+ erts_alcu_verify_unused(allctr);
+#ifdef USE_THREADS
+ erts_mtx_unlock(&allctr->mutex);
+#endif
+}
+
#ifdef ERTS_ALLOC_UTIL_HARD_DEBUG
static void