osfmk/man/vm_deallocate.html
Function - Deallocate a region of virtual memory.
**kern\_return\_t vm\_deallocate**** (vm\_task\_t **target\_task,** vm\_address\_t **address,** vm\_size\_t **size** );**
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.
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.
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.
KERN_INVALID_ADDRESS The address is illegal or specifies a non-allocated region.
Functions: mach_msg, vm_allocate, vm_map, host_page_size.