xref: /xnu-8792.61.2/osfmk/man/vm_deallocate.html (revision 42e220869062b56f8d7d0726fd4c88954f87902c)
1*42e22086SApple OSS Distributions<h2>vm_deallocate</h2>
2*42e22086SApple OSS Distributions<hr>
3*42e22086SApple OSS Distributions<p>
4*42e22086SApple OSS Distributions<strong>Function</strong> - Deallocate a region of virtual memory.
5*42e22086SApple OSS Distributions<h3>SYNOPSIS</h3>
6*42e22086SApple OSS Distributions<pre>
7*42e22086SApple OSS Distributions<strong>kern_return_t   vm_deallocate</strong>
8*42e22086SApple OSS Distributions                <strong>(vm_task_t</strong>                          <var>target_task</var>,
9*42e22086SApple OSS Distributions                 <strong>vm_address_t</strong>                           <var>address</var>,
10*42e22086SApple OSS Distributions                 <strong>vm_size_t</strong>                                 <var>size</var><strong>);</strong>
11*42e22086SApple OSS Distributions</pre>
12*42e22086SApple OSS Distributions<h3>PARAMETERS</h3>
13*42e22086SApple OSS Distributions<dl>
14*42e22086SApple OSS Distributions<p>
15*42e22086SApple OSS Distributions<dt> <var>target_task</var>
16*42e22086SApple OSS Distributions<dd>
17*42e22086SApple OSS Distributions[in task send right]
18*42e22086SApple OSS DistributionsThe port for the task in whose address space the
19*42e22086SApple OSS Distributionsregion is to be deallocated.
20*42e22086SApple OSS Distributions<p>
21*42e22086SApple OSS Distributions<dt> <var>address</var>
22*42e22086SApple OSS Distributions<dd>
23*42e22086SApple OSS Distributions[in scalar]
24*42e22086SApple OSS DistributionsThe starting address for the region.
25*42e22086SApple OSS Distributions<p>
26*42e22086SApple OSS Distributions<dt> <var>size</var>
27*42e22086SApple OSS Distributions<dd>
28*42e22086SApple OSS Distributions[in scalar]
29*42e22086SApple OSS DistributionsThe number of bytes to deallocate.
30*42e22086SApple OSS Distributions</dl>
31*42e22086SApple OSS Distributions<h3>DESCRIPTION</h3>
32*42e22086SApple OSS Distributions<p>
33*42e22086SApple OSS DistributionsThe <strong>vm_deallocate</strong> function deallocates a region of
34*42e22086SApple OSS Distributionsvirtual memory in the
35*42e22086SApple OSS Distributionsspecified task's address space.
36*42e22086SApple OSS DistributionsThe region starts at the beginning of the virtual page containing
37*42e22086SApple OSS Distributions<var>address</var> and ends
38*42e22086SApple OSS Distributionsat the end of the virtual page containing <var>address</var>
39*42e22086SApple OSS Distributions+ <var>size</var> - 1.  Because of this
40*42e22086SApple OSS Distributionsrounding to virtual page boundaries, the amount of memory deallocated may be
41*42e22086SApple OSS Distributionsgreater than <var>size</var>.  Use <strong>host_page_size</strong>
42*42e22086SApple OSS Distributionsto find the current virtual page size.
43*42e22086SApple OSS Distributions<p>
44*42e22086SApple OSS Distributions<strong>vm_deallocate</strong> affects only <var>target_task</var>.  Other tasks
45*42e22086SApple OSS Distributionsthat have access to the deallocated memory can continue to reference it.
46*42e22086SApple OSS Distributions<h3>NOTES</h3>
47*42e22086SApple OSS Distributions<p>
48*42e22086SApple OSS Distributions<strong>vm_deallocate</strong> can be used to deallocate memory passed
49*42e22086SApple OSS Distributionsas out-of-line data in a
50*42e22086SApple OSS Distributionsmessage.
51*42e22086SApple OSS Distributions<p>
52*42e22086SApple OSS DistributionsThis interface is machine word length specific because of the virtual address
53*42e22086SApple OSS Distributionsparameter.
54*42e22086SApple OSS Distributions<h3>RETURN VALUES</h3>
55*42e22086SApple OSS Distributions<dl>
56*42e22086SApple OSS Distributions<p>
57*42e22086SApple OSS Distributions<dt> <strong>KERN_INVALID_ADDRESS</strong>
58*42e22086SApple OSS Distributions<dd>
59*42e22086SApple OSS DistributionsThe address is illegal or specifies a non-allocated region.
60*42e22086SApple OSS Distributions</dl>
61*42e22086SApple OSS Distributions<h3>RELATED INFORMATION</h3>
62*42e22086SApple OSS Distributions<p>
63*42e22086SApple OSS DistributionsFunctions:
64*42e22086SApple OSS Distributions<a href="mach_msg.html"><strong>mach_msg</strong></a>,
65*42e22086SApple OSS Distributions<a href="vm_allocate.html"><strong>vm_allocate</strong></a>,
66*42e22086SApple OSS Distributions<a href="vm_map.html"><strong>vm_map</strong></a>,
67*42e22086SApple OSS Distributions<a href="host_page_size.html"><strong>host_page_size</strong></a>.
68