---
title: dealloc
framework: objectivec
role: symbol
role_heading: Instance Method
path: objectivec/nsobject-swift.class/dealloc
---

# dealloc

Deallocates the memory occupied by the receiver.

## Declaration

```occ
- (void) dealloc;
```

## Discussion

Discussion Subsequent messages to the receiver may generate an error indicating that a message was sent to a deallocated object (provided the deallocated memory hasn’t been reused yet). You override this method to dispose of resources other than the object’s instance variables, for example: - (void)dealloc {     free(myBigBlockOfMemory); } In an implementation of dealloc, do not invoke the superclass’s implementation. You should try to avoid managing the lifetime of limited resources such as file descriptors using dealloc. You never send a dealloc message directly. Instead, an object’s dealloc method is invoked by the runtime. See Advanced Memory Management Programming Guide for more details. Special Considerations When not using ARC, your implementation of dealloc must invoke the superclass’s implementation as its last instruction.

## See Also

### Creating, Copying, and Deallocating Objects

- [alloc](objectivec/nsobject-swift.class/alloc.md)
- [allocWithZone:](objectivec/nsobject-swift.class/allocwithzone:.md)
- [init()](objectivec/nsobject-swift.class/init().md)
- [copy()](objectivec/nsobject-swift.class/copy().md)
- [copyWithZone:](objectivec/nsobject-swift.class/copywithzone:.md)
- [mutableCopy()](objectivec/nsobject-swift.class/mutablecopy().md)
- [mutableCopyWithZone:](objectivec/nsobject-swift.class/mutablecopywithzone:.md)
- [new](objectivec/nsobject-swift.class/new.md)
