trigger garbage collection *after* requests, not before

This commit is contained in:
Aleksey Kladov 2019-05-29 14:35:02 +03:00
parent 6a1e3e59cb
commit 118a2113c1

View File

@ -171,7 +171,6 @@ fn main_loop_inner(
let (libdata_sender, libdata_receiver) = unbounded(); let (libdata_sender, libdata_receiver) = unbounded();
loop { loop {
let _p = profile("loop_turn"); let _p = profile("loop_turn");
state.maybe_collect_garbage();
log::trace!("selecting"); log::trace!("selecting");
let event = select! { let event = select! {
@ -193,13 +192,17 @@ fn main_loop_inner(
} }
let mut state_changed = false; let mut state_changed = false;
match event { match event {
Event::Task(task) => on_task(task, msg_sender, pending_requests), Event::Task(task) => {
on_task(task, msg_sender, pending_requests);
state.maybe_collect_garbage();
}
Event::Vfs(task) => { Event::Vfs(task) => {
state.vfs.write().handle_task(task); state.vfs.write().handle_task(task);
state_changed = true; state_changed = true;
} }
Event::Lib(lib) => { Event::Lib(lib) => {
state.add_lib(lib); state.add_lib(lib);
state.maybe_collect_garbage();
in_flight_libraries -= 1; in_flight_libraries -= 1;
} }
Event::Msg(msg) => match msg { Event::Msg(msg) => match msg {