Skip to content
This repository was archived by the owner on Nov 17, 2020. It is now read-only.

Commit 4d65090

Browse files
Introduce rabbit_runtime:gc_all_processes/0
1 parent f17b7f5 commit 4d65090

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/rabbit_runtime.erl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
%% API
2424
%%
2525

26-
-export([guess_number_of_cpu_cores/0, get_gc_info/1, msacc_stats/1]).
26+
-export([guess_number_of_cpu_cores/0, msacc_stats/1]).
27+
-export([get_gc_info/1, gc_all_processes/0]).
2728

2829

2930
-spec guess_number_of_cpu_cores() -> pos_integer().
@@ -34,6 +35,13 @@ guess_number_of_cpu_cores() ->
3435
N -> N
3536
end.
3637

38+
-spec gc_all_processes() -> ok.
39+
gc_all_processes() ->
40+
%% Run GC asynchronously. We don't care for completion notifications, so
41+
%% don't use the asynchonous execution option.
42+
spawn(fun() -> [erlang:garbage_collect(P, []) || P <- erlang:processes()] end),
43+
ok.
44+
3745
-spec get_gc_info(pid()) -> nonempty_list(tuple()).
3846
get_gc_info(Pid) ->
3947
{garbage_collection, GC} = erlang:process_info(Pid, garbage_collection),

0 commit comments

Comments
 (0)