summaryrefslogtreecommitdiff
path: root/src/background_gc.erl
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2012-11-12 16:55:09 +0000
committerSimon MacMullen <simon@rabbitmq.com>2012-11-12 16:55:09 +0000
commit57fc2f428c28909a75ad1ef9a0cf3b81fc42fde0 (patch)
tree1ebb6eb7b79f9df8db322a2276fdfd74bd0ca113 /src/background_gc.erl
parent5be572e8357f3519053ea7320cbeeea51cfc556e (diff)
downloadrabbitmq-server-57fc2f428c28909a75ad1ef9a0cf3b81fc42fde0.tar.gz
Don't hibernate, GC self instead.
Diffstat (limited to 'src/background_gc.erl')
-rw-r--r--src/background_gc.erl9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/background_gc.erl b/src/background_gc.erl
index d781a290..0275700f 100644
--- a/src/background_gc.erl
+++ b/src/background_gc.erl
@@ -23,9 +23,6 @@
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3]).
--define(HIBERNATE_AFTER_MIN, 1000).
--define(DESIRED_HIBERNATE, 10000).
-
-define(MAX_RATIO, 0.01).
-define(IDEAL_INTERVAL, 60000).
@@ -52,15 +49,14 @@ run() ->
%%----------------------------------------------------------------------------
init([]) ->
- {ok, run_gc(#state{last_interval = ?IDEAL_INTERVAL}), hibernate,
- {backoff, ?HIBERNATE_AFTER_MIN, ?HIBERNATE_AFTER_MIN, ?DESIRED_HIBERNATE}}.
+ {ok, run_gc(#state{last_interval = ?IDEAL_INTERVAL})}.
handle_call(Msg, _From, State) ->
{stop, {unexpected_call, Msg}, {unexpected_call, Msg}, State}.
handle_cast(run, State) ->
do_gc(),
- {noreply, State, hibernate};
+ {noreply, State};
handle_cast(Msg, State) ->
{stop, {unexpected_cast, Msg}, State}.
@@ -88,4 +84,5 @@ run_gc(State = #state{last_interval = LastInterval}) ->
do_gc() ->
[garbage_collect(P) || P <- processes(),
{status, waiting} == process_info(P, status)],
+ garbage_collect(self()), %% Since we will never be waiting...
ok.