diff options
author | Björn Gustavsson <[email protected]> | 2011-08-16 08:21:18 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2011-08-18 10:00:30 +0200 |
commit | 26cceb7a0718182e74083b4ad044985e8f624ee2 (patch) | |
tree | 3941aa0ac18fe7ad1bb43c483a2a73af1a05900d /lib/debugger | |
parent | 8d4e85f4db41db07d4e59762d8d938ed3d6c8af5 (diff) | |
download | otp-26cceb7a0718182e74083b4ad044985e8f624ee2.tar.gz otp-26cceb7a0718182e74083b4ad044985e8f624ee2.tar.bz2 otp-26cceb7a0718182e74083b4ad044985e8f624ee2.zip |
debugger: By default, only save non-tail-recursive calls
By default, the debugger use to save all calls on its simulated
stack. That could facilitate finding errors, but it could also
mean that the Debugger could become very slow while executing
tail-recursive code.
Diffstat (limited to 'lib/debugger')
-rw-r--r-- | lib/debugger/doc/src/debugger_chapter.xml | 18 | ||||
-rw-r--r-- | lib/debugger/doc/src/int.xml | 4 | ||||
-rw-r--r-- | lib/debugger/src/dbg_iserver.erl | 2 |
3 files changed, 11 insertions, 13 deletions
diff --git a/lib/debugger/doc/src/debugger_chapter.xml b/lib/debugger/doc/src/debugger_chapter.xml index 67e95cd083..2d812b0236 100644 --- a/lib/debugger/doc/src/debugger_chapter.xml +++ b/lib/debugger/doc/src/debugger_chapter.xml @@ -274,17 +274,15 @@ c_break(Bindings) -> <seealso marker="#attach">the Attach Process window</seealso>. </p> - <p>By default, the Debugger saves information about all current + <p>By default, the Debugger only saves information about recursive function calls, that is, function calls that have not yet returned - a value (option 'Stack On, Tail').</p> - - <p>This means, however, that information is saved also for tail - recursive calls. For example, repeated calls to the <c>loop</c> - function of an Erlang process. This may consume unnecessary - amounts of memory for debugged processes with long lifetimes and - many tail recursive calls. It is therefore possible to set - the option 'Stack On, no tail', in which case information about - previous calls are discarded when a tail recursive call is made. + a value (option 'Stack On, No Tail').</p> + + <p>Sometimes, however, it can be useful to save all calls, even + tail-recursive calls. That can be done with the 'Stack On, Tail' + option. Note that this option will consume more memory and slow + down execution of interpreted functions when there are many + tail-recursive calls. </p> <p>It is also possible to turn off the Debugger stack trace diff --git a/lib/debugger/doc/src/int.xml b/lib/debugger/doc/src/int.xml index 8b55461a44..c9d815755d 100644 --- a/lib/debugger/doc/src/int.xml +++ b/lib/debugger/doc/src/int.xml @@ -284,12 +284,12 @@ spawn(Module, Name, [Pid | Args]) <list> <item><c>all</c> - save information about all current calls, that is, function calls that have not yet returned a value. - This is the default.</item> + </item> <item><c>no_tail</c> - save information about current calls, but discard previous information when a tail recursive call is made. This option consumes less memory and may be necessary to use for processes with long lifetimes and many - tail recursive calls.</item> + tail recursive calls. This is the default.</item> <item><c>false</c> - do not save any information about current calls.</item> </list> diff --git a/lib/debugger/src/dbg_iserver.erl b/lib/debugger/src/dbg_iserver.erl index 55ac1cef94..1bb73a43b9 100644 --- a/lib/debugger/src/dbg_iserver.erl +++ b/lib/debugger/src/dbg_iserver.erl @@ -114,7 +114,7 @@ init([]) -> process_flag(trap_exit, true), global:register_name(?MODULE, self()), Db = ets:new(?MODULE, [ordered_set, protected]), - {ok, #state{db=Db, auto=false, stack=all}}. + {ok, #state{db=Db, auto=false, stack=no_tail}}. %% Attaching to a process handle_call({attached, AttPid, Pid}, _From, State) -> |