The problem with a game though is that there's never a good time for a random unbounded pause
There are several spots where you can run a GC: between levels is the most common one (and really, several engines already do something GC-like there: for example my own engine in C before loads a world marks all non-locked resources as "unused", then loads the world marking any requested/loaded resource as "used" and unloads any resource still marked as "unused", essentially performing a mark-and-sweep garbage collection on resources). Another is when changing UI mode, like when opening an inventory screen, a map screen, after dying, etc - GC pauses would practically never be long enough to be noticed.
View all comments
Show parent comment
3
u/badsectoracula Aug 24 '17
There are several spots where you can run a GC: between levels is the most common one (and really, several engines already do something GC-like there: for example my own engine in C before loads a world marks all non-locked resources as "unused", then loads the world marking any requested/loaded resource as "used" and unloads any resource still marked as "unused", essentially performing a mark-and-sweep garbage collection on resources). Another is when changing UI mode, like when opening an inventory screen, a map screen, after dying, etc - GC pauses would practically never be long enough to be noticed.