aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2016-07-07 15:50:03 +0200
committerLukas Larsson <[email protected]>2016-07-11 10:11:40 +0200
commit3b186417f6641a3aa13a46e00712d7dfcb29fc0f (patch)
treef4bb567f1178c920d3495176695f9a5f6f4a76c0 /erts
parent53bf2a9593a2f34151016f7d84fad6d213d76ee9 (diff)
downloadotp-3b186417f6641a3aa13a46e00712d7dfcb29fc0f.tar.gz
otp-3b186417f6641a3aa13a46e00712d7dfcb29fc0f.tar.bz2
otp-3b186417f6641a3aa13a46e00712d7dfcb29fc0f.zip
erts: After a call to a tracer nif, reset htop
This is needed in order for the heap to never contain any pointers to invalid memory. This is good for performance and debugging reasons.
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/erl_nif.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c
index 23931f0e54..c6127a4967 100644
--- a/erts/emulator/beam/erl_nif.c
+++ b/erts/emulator/beam/erl_nif.c
@@ -3502,6 +3502,7 @@ Eterm erts_nif_call_function(Process *p, Process *tracee,
struct enif_environment_t env;
ErlHeapFragment *orig_hf = MBUF(p);
ErlOffHeap orig_oh = MSO(p);
+ Eterm *orig_htop = HEAP_TOP(p);
ASSERT(is_internal_pid(p->common.id));
MBUF(p) = NULL;
clear_offheap(&MSO(p));
@@ -3523,6 +3524,7 @@ Eterm erts_nif_call_function(Process *p, Process *tracee,
/* restore original heap fragment list */
MBUF(p) = orig_hf;
MSO(p) = orig_oh;
+ HEAP_TOP(p) = orig_htop;
} else {
/* Nif call was done without a process context,
so we create a phony one. */