aboutsummaryrefslogtreecommitdiffstats
path: root/lib/debugger/src/dbg_istk.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2011-03-31 08:19:21 +0200
committerBjörn Gustavsson <[email protected]>2011-08-16 08:58:48 +0200
commit19713d214462b863def874385844521f00a2bac5 (patch)
treeb750efbf15db4cdb643da8fb3e97c33f94da12f2 /lib/debugger/src/dbg_istk.erl
parent3a7e7db5280dfdc7ef6488fb66a2cf60950ca34c (diff)
downloadotp-19713d214462b863def874385844521f00a2bac5.tar.gz
otp-19713d214462b863def874385844521f00a2bac5.tar.bz2
otp-19713d214462b863def874385844521f00a2bac5.zip
Delay saving of the stack in exit_info when an exception occurs
When an exception occurs, the entire stack will be converted to the external term format and kept in the exit_info variable in the process dictionary. But the exit_info variable will only be needed if the exception causes the process to terminate (not if it is caught). Delay the conversion of the stack to external format. That can save significant amounts of time (e.g. in bs_construct:mem_leak/1).
Diffstat (limited to 'lib/debugger/src/dbg_istk.erl')
-rw-r--r--lib/debugger/src/dbg_istk.erl7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/debugger/src/dbg_istk.erl b/lib/debugger/src/dbg_istk.erl
index 34070aa8f2..a0d3069d50 100644
--- a/lib/debugger/src/dbg_istk.erl
+++ b/lib/debugger/src/dbg_istk.erl
@@ -17,7 +17,7 @@
%% %CopyrightEnd%
%%
-module(dbg_istk).
--export([init/0,to_external/0,from_external/1,
+-export([init/0,delayed_to_external/0,from_external/1,
push/2,pop/0,pop/1,stack_level/0,
delayed_stacktrace/0,delayed_stacktrace/2,
bindings/1,stack_frame/2,backtrace/2,
@@ -37,8 +37,9 @@
init() ->
init([]).
-to_external() ->
- {stack,term_to_binary(get(?STACK))}.
+delayed_to_external() ->
+ Stack = get(?STACK),
+ fun() -> {stack,term_to_binary(Stack)} end.
from_external({stack,Stk}) ->
put(?STACK, binary_to_term(Stk)).