Go to the previous, next section.

Unloading

You can discard the functions and variables loaded by a library to reclaim memory for other Lisp objects. To do this, use the function unload-feature:

Command: unload-feature feature

This command unloads the library that provided feature feature. It undefines all functions and variables defined with defvar, defmacro, defconst, defsubst and defalias by the library which provided feature feature. It then restores any autoloads associated with those symbols.

The unload-feature function is written in Lisp; its actions are based on the variable load-history.

Variable: load-history feature association list

This variable's value is an alist connecting library names with the names of functions and variables they define, the features they provide, and the features they require.

Each element is a list and describes one library. The CAR of the list is the name of the library, as a string. The rest of the list is composed of these kinds of objects:

The value of load-history may have one element whose CAR is nil. This element describes definitions made with eval-buffer on a buffer that is not visiting a file.

The command eval-region updates load-history, but does so by adding the symbols defined to the element for the file being visited, rather than replacing that element.

Go to the previous, next section.