## memory_object_create

Function - Request that the default pager handle management requests on the specified memory object.

### SYNOPSIS

    kern_return_t   memory_object_create
                    (memory_object_t                          pager,
                     memory_object_t              new_memory_object,
                     vm_size_t                      new_object_size,
                     memory_object_control_t            new_control,
                     vm_size_t                        new_page_size);

    kern_return_t   seqnos_memory_object_create
                    (memory_object_t                          pager,
                     mach_port_seqno_t                        seqno,
                     memory_object_t              new_memory_object,
                     vm_size_t                      new_object_size,
                     memory_object_control_t            new_control,
                     vm_size_t                        new_page_size);

### PARAMETERS

pager
  [in default-pager (receive) right] The default memory manager service port.

seqno
  [in scalar] The sequence number of this message relative to the pager port.

new_memory_object
  [in abstract-memory-object receive right] The port representing the new abstract memory object created by the kernel.

new_object_size
  [in scalar] The expected size for the new object, in bytes.

new_control
  [in memory-cache-control send right] The memory cache control port to be used by the memory manager when making cache management requests for the new object.

new_page_size
  [in scalar] The page size used by the kernel. All calls involving this kernel must use data sizes that are integral multiples of this page size.

### DESCRIPTION

A memory_object_create function is called as the result of a message from the kernel requesting that the default memory manager accept responsibility for the new memory object created by the kernel. The kernel makes this call only to the system default memory manager.

The new memory object initially consists of zero-filled pages. Only memory pages that are actually written are provided to the memory manager. When processing memory_object_data_request calls from the kernel, the default memory manager must use memory_object_data_unavailable for any pages that have not been written previously.

The kernel does not expect a reply to this call. The kernel assumes that the default memory manager will be ready to handle data requests to this object and does not need the confirmation of a memory_object_change_attributes call.

### NOTES

The kernel requires memory objects to provide temporary backing storage for zero-filled memory created by vm_allocate calls, issued by both user tasks and the kernel itself. The kernel allocates an abstract memory object port to represent the temporary backing storage and uses memory_object_create to pass the new memory object to the default memory manager, which provides the storage.

The default memory manager is a trusted system component that is identified to the kernel at system initialization time. The default memory manager can also be changed at run time using the host_default_memory_manager call.

The contents of a kernel-created (as opposed to a user-created) memory object can be modified only in main memory. The default memory manager must not change the contents of a temporary memory object, or allow unrelated tasks to access the memory object, control, or name port.

The kernel provides the size of a temporary memory object based on the allocated size. Since the object is not mapped by other tasks, the object will not grow by explicit action. However, the kernel may coalesce adjacent temporary objects in such a way that this object may appear to grow. As such, the supplied object size is merely a hint as to the maximum size.

### RETURN VALUES

Only generic errors apply.

### RELATED INFORMATION

Functions: default_pager_object_create, memory_object_data_initialize, memory_object_data_unavailable, memory_object_default_server, seqnos_memory_object_default_server.