1<h2>memory_object_destroy</h2>
2<hr>
3<p>
4<strong>Function</strong> - Shut down a memory object.
5<h3>SYNOPSIS</h3>
6<pre>
7<strong>kern_return_t   memory_object_destroy</strong>
8                <strong>(memory_object_control_t</strong>         <var>memory_control</var>,
9                 <strong>kern_return_t</strong>                           <var>reason</var><strong>);</strong>
10</pre>
11<h3>PARAMETERS</h3>
12<dl>
13<p>
14<dt> <var>memory_control</var> 
15<dd>
16[in memory-cache-control send right]
17The memory cache control port 
18to be used by the memory manager for cache management requests. 
19This port is provided by the kernel in a <strong>memory_object_init</strong> call.
20<p>
21<dt> <var>reason</var> 
22<dd>
23[in scalar]
24An error code indicating when the object must be destroyed.
25</dl>
26<h3>DESCRIPTION</h3>
27<p>
28The <strong>memory_object_destroy</strong> function tells the kernel to shut down the
29specified memory object.  As a result of this call, the kernel
30no longer supports
31paging activity or any memory object calls on the memory object.
32The kernel issues 
33a <strong>memory_object_terminate</strong> call to pass to the memory
34manager all rights to 
35the memory object port and the memory control port.
36<p>
37To ensure that any modified cached data is returned before the object is
38terminated, the memory manager should call <strong>memory_object_lock_request</strong>
39with
40<var>should_flush</var> set and a 
41lock value of <strong>VM_PROT_WRITE</strong> before it makes the 
42<strong>memory_object_destroy</strong> call.
43<h3>NOTES</h3>
44<p>
45The <var>reason</var> code is currently ignored by the kernel.
46<h3>RETURN VALUES</h3>
47<p>
48Only generic errors apply.
49<h3>RELATED INFORMATION</h3>
50<p>
51Functions:
52<a href="memory_object_lock_request.html"><strong>memory_object_lock_request</strong></a>,
53<a href="memory_object_terminate.html"><strong>memory_object_terminate</strong></a>.
54