aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/src/dialyzer_cl.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2017-01-17 15:10:58 +0100
committerHans Bolinder <[email protected]>2017-02-03 08:58:00 +0100
commit2c577356c419b9420cae91a74d4b1602d584275a (patch)
tree8fc211d0118c8f49fa6ea436511ad7a5e481839a /lib/dialyzer/src/dialyzer_cl.erl
parente917ae0da957a8b151df54e2f1940fded8d21ad1 (diff)
downloadotp-2c577356c419b9420cae91a74d4b1602d584275a.tar.gz
otp-2c577356c419b9420cae91a74d4b1602d584275a.tar.bz2
otp-2c577356c419b9420cae91a74d4b1602d584275a.zip
dialyzer: Use less memory for the PLT when analyzing
The two tables for (record) types and exported types are no longer kept in memory (by the PLT) when analyzing, which reduces memory consumption. A first step towards removing (or replacing) the #plt{} record.
Diffstat (limited to 'lib/dialyzer/src/dialyzer_cl.erl')
-rw-r--r--lib/dialyzer/src/dialyzer_cl.erl16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/dialyzer/src/dialyzer_cl.erl b/lib/dialyzer/src/dialyzer_cl.erl
index 158ee761af..93200f53d2 100644
--- a/lib/dialyzer/src/dialyzer_cl.erl
+++ b/lib/dialyzer/src/dialyzer_cl.erl
@@ -30,6 +30,8 @@
-record(cl_state,
{backend_pid :: pid() | 'undefined',
+ code_server = none :: 'none'
+ | dialyzer_codeserver:codeserver(),
erlang_mode = false :: boolean(),
external_calls = [] :: [mfa()],
external_types = [] :: [mfa()],
@@ -630,6 +632,9 @@ cl_loop(State, LogCache) ->
{BackendPid, warnings, Warnings} ->
NewState = store_warnings(State, Warnings),
cl_loop(NewState, LogCache);
+ {BackendPid, cserver, CodeServer, _Plt} -> % Plt is ignored
+ NewState = State#cl_state{code_server = CodeServer},
+ cl_loop(NewState, LogCache);
{BackendPid, done, NewMiniPlt, _NewDocPlt} ->
return_value(State, NewMiniPlt);
{BackendPid, ext_calls, ExtCalls} ->
@@ -647,7 +652,6 @@ cl_loop(State, LogCache) ->
cl_error(State, Msg);
_Other ->
%% io:format("Received ~p\n", [_Other]),
- %% Note: {BackendPid, cserver, CodeServer, Plt} is ignored.
cl_loop(State, LogCache)
end.
@@ -688,12 +692,20 @@ cl_error(State, Msg) ->
maybe_close_output_file(State),
throw({dialyzer_error, lists:flatten(Msg)}).
-return_value(State = #cl_state{erlang_mode = ErlangMode,
+return_value(State = #cl_state{code_server = CodeServer,
+ erlang_mode = ErlangMode,
mod_deps = ModDeps,
output_plt = OutputPlt,
plt_info = PltInfo,
stored_warnings = StoredWarnings},
MiniPlt) ->
+ %% Just for now:
+ case CodeServer =:= none of
+ true ->
+ ok;
+ false ->
+ dialyzer_codeserver:delete(CodeServer)
+ end,
case OutputPlt =:= none of
true ->
dialyzer_plt:delete(MiniPlt);