All Manuals > LispWorks® User Guide and Reference Manual > 17 iOS interface

17.6 The Mobile GC

The Mobile GC is a 64-bit GC that is written to run on 64-bit iOS (we are also considering using it for 64-bit Android). When LispWorks is delivered for 64-bit iOS, the "saved image" (the code in the object file that delivery creates) switches automatically to use the Mobile GC. Thus normally you do not need to know anything about the Mobile GC, and if your application has moderate memory requirements (a few tens of megabytes of live allocation at run time), then there is a good chance that you do not need to do anything about memory management.

However, it is useful in general to create a log file of the activity of the application (at least during development), and to include the output of periodic calls to (room) or (room nil) in this log, which will give you some idea of the memory behavior of your application. In particular, if the "Total allocated" that is reported in the last line of (room) (which is the only line in (room nil)) approaches 100 MB then you may want to look at memory management. Note that is only for a mobile device: Desktop applications can grow much larger without a problem.

The main problem that you may encounter in the Mobile GC are GCs of generation 2 causing noticeable delays (on the order of 1 second, depending on the size of the application and the hardware). Depending on the application, such delays may or may not be an issue, but for most GUI applications you should ensure they do not happen too frequently. In this situation you should consult 11.5.3.2 Preventing/reducing GC of generation 2.

You may also consider implementing a response to low memory warning from the OS. All applications can benefit a little by calling reduce-memory with nil or 0 or 1 at that point, but for most applications the benefit is minimal. If most of the live memory in your application contains caches that can be freed and recreated again without much loss in performance, you may be able to get significant improvement by implementing a low memory warning response that clears the caches. Consult 11.5.3.1 Response to low memory for details.

The output of room and the results of related functions are different when the Mobile GC is used. If you want to understand this output better, consult 11.5.2 Mobile GC technical details.


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:21