All Manuals > Foreign Language Interface User Guide and Reference Manual > 7 Function, Macro and Variable Reference

free-foreign-object

free Functions

Summary

Deallocates the space in memory pointed to by a pointer.

Package

fli

Signatures

free-foreign-object pointer => null-pointer

free pointer => null-pointer

Arguments
pointer
A pointer to the object to de-allocate.
Values
null-pointer
A pointer with address zero.
Description

The free-foreign-object function deallocates the space in memory pointed to by pointer, which frees the memory for other uses. The address of pointer is the start of a block of memory previously allocated by allocate-foreign-object.

If pointer is a null pointer then free-foreign-object takes no action.

The function free is a synonym for free-foreign-object.

Examples

In the following example a boolean type is defined and an instance is created with memory allocated using allocate-foreign-object. The function free-foreign-object is then used to free up the memory used by the boolean.

(fli:define-c-typedef BOOL (:boolean :int))
(setq point (fli:allocate-foreign-object :type 'BOOL))
(fli:free-foreign-object point)
See also

allocate-foreign-object
1.4 An example of dynamic memory allocation
3.1.3 Allocation of FLI memory


Foreign Language Interface User Guide and Reference Manual - 01 Dec 2021 19:34:58