11.1 General strategy for reducing the image size

In many cases, the size of the image can be reduced if part of the user code or data is eliminated, for example, when this code or data is present only for debugging purposes. The system, however, cannot tell which part of the code or data can be eliminated, so you have to do it yourself.

That can be done in either of two ways:

You can eliminate the code or data explictly before calling deliver, by using
fmakunbound
,
makunbound
,
remhash
and so on. The advantage of this approach is that it does not require you to know anything about Delivery. The disadvantage of this is that these calls must be put explicitly in the delivery script.

The LispWorks image contains an action list called "Delivery actions", which you can add actions to. See the
LispWorks User Guide and Reference Manual
for information about action lists.

The "Delivery actions" action list is executed when the delivery process starts, before any system action. For example, if
*my-hash-table*
contains entries that are not required in the delivered application, then you may write:

(defun clear-my-hash-table()

(maphash #'(lambda (x y)

(unless (required-in-the-application-p x y)

(remhash x *my-hash-table*)))

*my-hash-table*))

(define-action "delivery actions" "Clear my hash table"

'clear-my-hash-table)

Using the action list has two advantages:

It does not have to be part of the
deliver
script, so it can be written near the code that uses
*my-hash-table*
. This makes it easier to maintain that code.

It can access the user interface of the delivery process. This is done via the function delivery-value and
(setf delivery-value)
.