vm_deallocate.html   [plain text]

<strong>Function</strong> - Deallocate a region of virtual memory.
<strong>kern_return_t   vm_deallocate</strong>
                <strong>(vm_task_t</strong>                          <var>target_task</var>,
                 <strong>vm_address_t</strong>                           <var>address</var>,
                 <strong>vm_size_t</strong>                                 <var>size</var><strong>);</strong>
<dt> <var>target_task</var> 
[in task send right]
The port for the task in whose address space the
region is to be deallocated.
<dt> <var>address</var> 
[in scalar]
The starting address for the region.
<dt> <var>size</var> 
[in scalar]
The number of bytes to deallocate.
The <strong>vm_deallocate</strong> 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
<var>address</var> and ends 
at the end of the virtual page containing <var>address</var>
+ <var>size</var> - 1.  Because of this 
rounding to virtual page boundaries, the amount of memory deallocated may be 
greater than <var>size</var>.  Use <strong>host_page_size</strong> 
to find the current virtual page size.
<strong>vm_deallocate</strong> affects only <var>target_task</var>.  Other tasks
that have access to the deallocated memory can continue to reference it.
<strong>vm_deallocate</strong> can be used to deallocate memory passed
as out-of-line data in a 
This interface is machine word length specific because of the virtual address
<dt> <strong>KERN_INVALID_ADDRESS</strong>
The address is illegal or specifies a non-allocated region.
<a href="mach_msg.html"><strong>mach_msg</strong></a>,
<a href="vm_allocate.html"><strong>vm_allocate</strong></a>,
<a href="vm_map.html"><strong>vm_map</strong></a>,
<a href="host_page_size.html"><strong>host_page_size</strong></a>.