It's part of afni.c -- a function that the dataset loading function can call if it runs out of memory. Other programs don't provide such a "feed me Seymour" function, so if a dataset fails to load in any of the 3d*** programs, they just explode.
In afni.c, the FMS function (a name and acronym I just invented) goes thru and purges from RAM all datasets that aren't being viewed at that moment, and that can be restored from disk. So this code is special to afni.c and not re-usable in other situations.