---
title: "allocWithZone:"
framework: foundation
role: article
role_heading: Article
path: foundation/nsport-allocwithzone
---

# allocWithZone:

Returns an instance of the NSMachPort class.

## Overview

Overview For backward compatibility on Mach, allocWithZone: returns an instance of the NSMachPort class when sent to the NSPort class. Otherwise, it returns an instance of a concrete subclass that can be used for messaging between threads or processes on the local machine, or, in the case of NSSocketPort, between processes on separate machines.

## See Also

### Related Documentation

- [Threading Programming Guide](apple-archive/documentation/Cocoa/Conceptual/Multithreading/Introduction.md)
- [Distributed Objects Programming Topics](apple-archive/documentation/Cocoa/Conceptual/DistrObjects.md)
