Flushmem only cleans the current and subscope. So if called from a function, it only frees stuff that was created during the running of this function, not what had existed before its execution.
Because of that, it is normally called in the mainloop as its commonly the "lowest" existing scope.
Because of that, it is normally called in the mainloop as its commonly the "lowest" existing scope.