Skip to content

Commit

Permalink
Use gc() more sparingly.
Browse files Browse the repository at this point in the history
Fix #454
  • Loading branch information
wlandau-lilly committed Jul 4, 2018
1 parent 9abd398 commit de5835f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/mclapply.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ mc_master <- function(config){
}

mc_worker <- function(worker, config){
on.exit(gc())
ready_queue <- mc_get_ready_queue(worker, config)
done_queue <- mc_get_done_queue(worker, config)
while (TRUE){
while (nrow(msg <- ready_queue$list(1)) < 1){
gc()
Sys.sleep(mc_wait)
}
if (identical(msg$message, "done")){
Expand Down Expand Up @@ -104,6 +104,7 @@ mc_worker <- function(worker, config){
ready_queue$pop(1)
message <- mc_get_checksum(target = target, config = config)
done_queue$push(title = target, message = message)
gc()
}
}

Expand Down

0 comments on commit de5835f

Please sign in to comment.