vm_deallocaterelinquishes access to a region of a task's address space, causing further access to that memory to fail. This address range will be available for reallocation. address is the starting address, which will be rounded down to a page boundary. size is the number of bytes to deallocate, which will be rounded up to give a page boundary. Note, that because of the rounding to virtual page boundaries, more than size bytes may be deallocated. Use
vm_statisticsto find out the current virtual page size.
This call may be used to deallocate memory that was passed to a task in a message (via out of line data). In that case, the rounding should cause no trouble, since the region of memory was allocated as a set of pages.
vm_deallocatecall affects only the task specified by the target_task. Other tasks which may have access to this memory may continue to reference it.
The function returns
KERN_SUCCESSif the memory was successfully deallocated and
KERN_INVALID_ADDRESSif an invalid or non-allocated address was specified.