<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ObjectiveC",
  "identifier" : "/documentation/ObjectiveC/NSObject-swift.class/allocWithZone:",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Objective-C Runtime"
    ],
    "preciseIdentifier" : "c:objc(cs)NSObject(cm)allocWithZone:"
  },
  "title" : "allocWithZone:"
}
-->

# allocWithZone:

Returns a new instance of the receiving class.

```
+ (instancetype) allocWithZone:(struct _NSZone *) zone;
```

## Parameters

`zone`

This parameter is ignored.

## Return Value

A new instance of the receiver.

## Discussion

The `isa` instance variable of the new instance is initialized to a data structure that describes the class; memory for all other instance variables is set to `0`.

You must use an `init...` method to complete the initialization process. For example:

```objc
TheClass *newObject = [[TheClass allocWithZone:nil] init];
```

Do not override [`allocWithZone:`](/documentation/ObjectiveC/NSObject-swift.class/allocWithZone:) to include any initialization code. Instead, class-specific versions of `init...` methods.

This method exists for historical reasons; memory zones are no longer used by Objective-C.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)