---
title: NSAllocateObject
framework: foundation
role: symbol
role_heading: Function
path: foundation/nsallocateobject
---

# NSAllocateObject

Creates and returns a new instance of a given class.

## Declaration

```occ
extern idNSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone);
```

## Parameters

- `aClass`: The class of which to create an instance.
- `extraBytes`: The number of extra bytes required for indexed instance variables (this value is typically 0).
- `zone`: The zone in which to create the new instance (pass NULL to specify the default zone).

## Return Value

Return Value A new instance of aClass or nil if an instance could not be created.

## Discussion

Discussion This function is deprecated and unavailable for use with ARC.

## See Also

### Object Allocation and Deallocation

- [NSCopyObject](foundation/nscopyobject.md)
- [NSDeallocateObject](foundation/nsdeallocateobject.md)
- [NSDecrementExtraRefCountWasZero](foundation/nsdecrementextrarefcountwaszero.md)
- [NSExtraRefCount](foundation/nsextrarefcount.md)
- [NSIncrementExtraRefCount](foundation/nsincrementextrarefcount.md)
- [NSShouldRetainWithZone](foundation/nsshouldretainwithzone.md)
