vm_deallocate


Function - Deallocate a region of virtual memory.

SYNOPSIS

kern_return_t   vm_deallocate
                (vm_task_t                          target_task,
                 vm_address_t                           address,
                 vm_size_t                                 size);

PARAMETERS

target_task
[in task send right] The port for the task in whose address space the region is to be deallocated.

address
[in scalar] The starting address for the region.

size
[in scalar] The number of bytes to deallocate.

DESCRIPTION

The vm_deallocate function deallocates a region of virtual memory in the specified task's address space. The region starts at the beginning of the virtual page containing address and ends at the end of the virtual page containing address + size - 1. Because of this rounding to virtual page boundaries, the amount of memory deallocated may be greater than size. Use host_page_size to find the current virtual page size.

vm_deallocate affects only target_task. Other tasks that have access to the deallocated memory can continue to reference it.

NOTES

vm_deallocate can be used to deallocate memory passed as out-of-line data in a message.

This interface is machine word length specific because of the virtual address parameter.

RETURN VALUES

KERN_INVALID_ADDRESS
The address is illegal or specifies a non-allocated region.

RELATED INFORMATION

Functions: mach_msg, vm_allocate, vm_map, host_page_size.