summaryrefslogtreecommitdiff
path: root/apps/couch
diff options
context:
space:
mode:
Diffstat (limited to 'apps/couch')
-rw-r--r--apps/couch/src/couch_os_process.erl3
-rw-r--r--apps/couch/src/couch_proc_manager.erl1
2 files changed, 4 insertions, 0 deletions
diff --git a/apps/couch/src/couch_os_process.erl b/apps/couch/src/couch_os_process.erl
index 0c6f284f..fb4bd5a9 100644
--- a/apps/couch/src/couch_os_process.erl
+++ b/apps/couch/src/couch_os_process.erl
@@ -168,6 +168,9 @@ handle_cast({send, Data}, #os_proc{writer=Writer, idle=Idle}=OsProc) ->
end;
handle_cast(stop, OsProc) ->
{stop, normal, OsProc};
+handle_cast(garbage_collect, #os_proc{idle=Idle} = OsProc) ->
+ erlang:garbage_collect(),
+ {noreply, OsProc, Idle};
handle_cast(Msg, #os_proc{idle=Idle}=OsProc) ->
?LOG_DEBUG("OS Proc: Unknown cast: ~p", [Msg]),
{noreply, OsProc, Idle}.
diff --git a/apps/couch/src/couch_proc_manager.erl b/apps/couch/src/couch_proc_manager.erl
index 568608bc..d09893eb 100644
--- a/apps/couch/src/couch_proc_manager.erl
+++ b/apps/couch/src/couch_proc_manager.erl
@@ -67,6 +67,7 @@ handle_call({ret_proc, #proc{client=Ref, pid=Pid} = Proc}, _From, State) ->
% #proc{} from our own table, so the alternative is to do a lookup in the
% table before the insert. Don't know which approach is cheaper.
case is_process_alive(Pid) of true ->
+ gen_server:cast(Pid, garbage_collect),
ets:insert(State#state.tab, Proc);
false -> ok end,
{reply, true, State};