aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_message.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2016-06-28 17:40:45 +0200
committerRickard Green <[email protected]>2016-08-30 16:58:15 +0200
commitf36e430a1482ee91d7f8b5ff72477ee6882b876d (patch)
tree879cdece142a9f7d250e3e4c1e68ceb010a4c6fa /erts/emulator/beam/erl_message.c
parent925984e94f2c1933bb659dfb626c191982b7c8d4 (diff)
downloadotp-f36e430a1482ee91d7f8b5ff72477ee6882b876d.tar.gz
otp-f36e430a1482ee91d7f8b5ff72477ee6882b876d.tar.bz2
otp-f36e430a1482ee91d7f8b5ff72477ee6882b876d.zip
Ensure correct mbuf_sz value in process structure
Diffstat (limited to 'erts/emulator/beam/erl_message.c')
-rw-r--r--erts/emulator/beam/erl_message.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_message.c b/erts/emulator/beam/erl_message.c
index 91e06cde2d..e4c696ae3b 100644
--- a/erts/emulator/beam/erl_message.c
+++ b/erts/emulator/beam/erl_message.c
@@ -1842,3 +1842,20 @@ void erts_factory_undo(ErtsHeapFactory* factory)
factory->heap_frags = NULL;
#endif
}
+
+Uint
+erts_mbuf_size(Process *p)
+{
+ Uint sz = 0;
+ ErlHeapFragment* bp;
+ ErtsMessage* mp;
+
+ for (bp = p->mbuf; bp; bp = bp->next)
+ sz += bp->used_size;
+
+ for (mp = p->msg_frag; mp; mp = mp->next)
+ for (bp = erts_message_to_heap_frag(mp); bp; bp = bp->next)
+ sz += bp->used_size;
+
+ return sz;
+}