From 38df9be8e5fabf9de15524fe176696b7e3bbeac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Tue, 18 Feb 2020 06:26:33 +0100 Subject: Don't keep stacktraces forever The `erlang:get_stacktrace/0` BIF retrieves the stacktrace from the previous error in the process. The problem is that the very existence of `erlang:get_stacktrace/0` means that the stacktrace and potentially function arguments must be kept indefinitely. Therefore, in OTP 21, the `erlang:get_stacktrace/0` BIF was deprecated and the syntax of try/catch extended to allow matching out the stacktrace directly. This commit changes `erlang:get_stacktrace/0` for OTP 23 to always return an empty list (`[]`) and eliminates the need to keep the stacktrace forever. `erlang:get_stacktrace/0` is scheduled for removal in OTP 24. --- erts/emulator/beam/bif.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'erts/emulator/beam/bif.c') diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c index 220b24128c..c472c4fadc 100644 --- a/erts/emulator/beam/bif.c +++ b/erts/emulator/beam/bif.c @@ -1006,8 +1006,7 @@ BIF_RETTYPE hibernate_3(BIF_ALIST_3) BIF_RETTYPE get_stacktrace_0(BIF_ALIST_0) { - Eterm t = build_stacktrace(BIF_P, BIF_P->ftrace); - BIF_RET(t); + BIF_RET(NIL); } /**********************************************************************/ -- cgit v1.2.1