Next: Data Transfer, Previous: Memory Allocation, Up: Virtual Memory Interface
vm_deallocate
relinquishes 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. Usevm_page_size
orvm_statistics
to 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.
The
vm_deallocate
call 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_SUCCESS
if the memory was successfully deallocated andKERN_INVALID_ADDRESS
if an invalid or non-allocated address was specified.