| Previous | Next |
| KERN_FAILURE | KERN_NOT_RECEIVER |
KERN_RESOURCE_SHORTAGE
KERN_RESOURCE_SHORTAGE means Mach could not allocate a system resource needed to satisfy the request. XNU explicitly describes this as potentially non-permanent. It is therefore different from a malformed request and different from KERN_NO_SPACE, which refers to an unsuitable virtual address range.
The code by itself does not identify which resource was scarce. Depending on the operation, the limiting factor can be memory-management metadata, a port or IPC-related resource, a kernel allocation, or another subsystem resource. Treating every occurrence as ordinary application heap exhaustion loses that context.
Practical response
- Record the exact Mach call, requested size, target task, and the preceding resource lifecycle events.
- Release resources that are no longer needed before retrying.
- Use a bounded retry only when the caller can safely tolerate a transient failure; an unbounded immediate retry can amplify pressure.
- Compare the failure with VM-map state. If the requested address range itself is the issue,
KERN_NO_SPACEis the more specific condition.
Apple's Mach model separates task address spaces, memory objects, ports, and IPC resources. The return code tells you allocation failed at the Mach layer; the failing API provides the context required to find the constrained resource.
References
- XNU: kern_return.h
- Apple Kernel Programming Guide: Mach overview
- GNU Mach Reference Manual: Virtual Memory Interface
Looking for a different code? Search another status or error code.