aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/src/dialyzer_plt.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_plt.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_plt.erl')
-rw-r--r--lib/dialyzer/src/dialyzer_plt.erl21
1 files changed, 8 insertions, 13 deletions
diff --git a/lib/dialyzer/src/dialyzer_plt.erl b/lib/dialyzer/src/dialyzer_plt.erl
index 511a17d577..26dfeac71e 100644
--- a/lib/dialyzer/src/dialyzer_plt.erl
+++ b/lib/dialyzer/src/dialyzer_plt.erl
@@ -31,10 +31,8 @@
included_files/1,
from_file/1,
get_default_plt/0,
- get_types/1,
get_module_types/2,
get_exported_types/1,
- %% insert/3,
insert_list/2,
insert_contract_list/2,
insert_callbacks/2,
@@ -189,20 +187,17 @@ lookup(Plt, Label) when is_integer(Label) ->
lookup_1(#mini_plt{info = Info}, MFAorLabel) ->
ets_table_lookup(Info, MFAorLabel).
--spec insert_types(plt(), erl_types:mod_records()) -> plt().
+-spec insert_types(plt(), ets:tid()) -> plt().
-insert_types(PLT, Rec) ->
- PLT#plt{types = Rec}.
+insert_types(MiniPLT, Records) ->
+ ets:rename(Records, plt_types),
+ MiniPLT#mini_plt{types = Records}.
--spec insert_exported_types(plt(), sets:set()) -> plt().
+-spec insert_exported_types(plt(), ets:tid()) -> plt().
-insert_exported_types(PLT, Set) ->
- PLT#plt{exported_types = Set}.
-
--spec get_types(plt()) -> erl_types:mod_records().
-
-get_types(#plt{types = Types}) ->
- Types.
+insert_exported_types(MiniPLT, ExpTypes) ->
+ ets:rename(ExpTypes, plt_exported_types),
+ MiniPLT#mini_plt{exported_types = ExpTypes}.
-spec get_module_types(plt(), atom()) ->
'none' | {'value', erl_types:type_table()}.