Closed cjyetman closed 7 months ago
for the record, @cjyetman does not believe that using gc()
is necessarily a bad thing to do
Maybe not!
My reaction to it may just be because I am not used to it or seeing that done in PROD elsewhere, not strictly a reaction to it fundamentally
My reaction to it is that it's a pretty clear code smell. If you're running close enough to the edge that auto-collection isn't cutting it, then it's probably time to explore other options (this ticket!)
I think the idea here is that use of gc()
implies a misuse of memory, e.g. making numerous, unnecessary large objects that need to be managed. The reality is that we have numerous large objects that need to be loaded, and we've already put a lot of effort into only loading them when needed, and getting rid of them once they're no longer needed, and now running gc()
immediately after they've been removed to force R to clean up after them immediately, which imo is proper usage. Closing this ticket.
There has to be a better way! But agree that this is an effective band-aid for now.
Originally posted by @jdhoffa in https://github.com/RMI-PACTA/workflow.data.preparation/pull/140#pullrequestreview-1884719033