GC liberally throughout view indexing code path
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/fdc3c732 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/fdc3c732 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/fdc3c732 Branch: refs/heads/import Commit: fdc3c732a80bea305ced1d251025752bb092aa6e Parents: 7a9fe22 Author: Adam Kocoloski <[email protected]> Authored: Fri Oct 28 15:53:07 2011 -0400 Committer: Paul J. Davis <[email protected]> Committed: Fri Jan 17 16:44:29 2014 -0800 ---------------------------------------------------------------------- src/couch_os_process.erl | 2 ++ src/couch_work_queue.erl | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/fdc3c732/src/couch_os_process.erl ---------------------------------------------------------------------- diff --git a/src/couch_os_process.erl b/src/couch_os_process.erl index 72bacc3..fcf9da5 100644 --- a/src/couch_os_process.erl +++ b/src/couch_os_process.erl @@ -229,6 +229,8 @@ handle_call({prompt, Data}, _From, #os_proc{idle=Idle}=OsProc) -> {stop, normal, OsError, OsProc}; throw:OtherError -> {stop, normal, OtherError, OsProc} + after + garbage_collect() end. handle_cast({send, Data}, #os_proc{writer=Writer, idle=Idle}=OsProc) -> http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/fdc3c732/src/couch_work_queue.erl ---------------------------------------------------------------------- diff --git a/src/couch_work_queue.erl b/src/couch_work_queue.erl index 1824453..ea871e2 100644 --- a/src/couch_work_queue.erl +++ b/src/couch_work_queue.erl @@ -83,7 +83,7 @@ init(Options) -> max_items = couch_util:get_value(max_items, Options, nil), multi_workers = couch_util:get_value(multi_workers, Options, false) }, - {ok, Q}. + {ok, Q, hibernate}. terminate(_Reason, #q{work_waiters=Workers}) -> @@ -97,14 +97,14 @@ handle_call({queue, Item, Size}, From, #q{work_waiters = []} = Q0) -> case (Q#q.size >= Q#q.max_size) orelse (Q#q.items >= Q#q.max_items) of true -> - {noreply, Q#q{blocked = [From | Q#q.blocked]}}; + {noreply, Q#q{blocked = [From | Q#q.blocked]}, hibernate}; false -> - {reply, ok, Q} + {reply, ok, Q, hibernate} end; handle_call({queue, Item, _}, _From, #q{work_waiters = [{W, _Max} | Rest]} = Q) -> gen_server:reply(W, {ok, [Item]}), - {reply, ok, Q#q{work_waiters = Rest}}; + {reply, ok, Q#q{work_waiters = Rest}, hibernate}; handle_call({dequeue, Max}, From, Q) -> #q{work_waiters = Workers, multi_workers = Multi, items = Count} = Q,
