NAME
vm_deallocate - releases a region of a task’s address space

SYNOPSIS
#include <mach.h>

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

ARGUMENTS
target_task Task whose virtual memory is to be affected.

address Starting address (will be rounded down to a page
boundary).

size Number of bytes to deallocate (will be rounded up to
give a page boundary).

DESCRIPTION
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. Note, that because of
the rounding to virtual page boundaries, more than size bytes may
be deallocated. Use vm_page_size or vm_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.

DIAGNOSTICS
KERN_SUCCESS Memory deallocated.

KERN_INVALID_ADDRESS Illegal or non-allocated address
specified.

SEE ALSO
vm_allocate(2), vm_statistics(2), msg_receive(2)