reduce-memory has the same effect as clean-down, except that clean-down may temporarily increase the size of the image in order to be able to promote from lower generations.
reduce-memory never increases the image size, which means that it may fail to promote. This will cause future garbage collections to be slower, until the promotion actually occurs.
reduce-memory is intended to be used when the operating system signals that the memory is low, which is a common feature of mobile platforms, for example
onLowMemory in Android and
didRceciveMemoryWarning in iOS. Using clean-down in this situation may cause a temporary increase in size, which may cause the system to run out of memory, or maybe just kill the Lisp process. In other circumstances clean-down should do a better job (and you might also consider try-move-in-generation).
When using the Mobile GC, if full is
reduce-memory just frees what it can free easily. If full is
reduce-memory performs a garbage collection on generation 2 and then frees what it can free easily. If full is
reduce-memory performs one or more garbage collections until memory is no longer being freed and then frees what it can free easily. When full is a integer (0, 1 or 2), it specifies a generation number to garbage collect and
reduce-memory garbage collects this generation and then frees what it can free easily. Using
2 is the same as using
nil, which is different from clean-down where it defaults to
reduce-memorywith no argument or
(clean-down nil)by trying to reduce the memory.
(clean-down nil)frees and promotes, but does not try to reduce the size (and may actually increase it).
reduce-memoryreleases any reserved memory that the system keeps. As a result any following
reduce-memorywith argument non-nil will be less effective because there will be no reserved memory to perform copying garbage collection.
LispWorks User Guide and Reference Manual - 20 Sep 2017