---
title: dispatch_retain
framework: dispatch
role: symbol
role_heading: Function
path: dispatch/dispatch_retain
---

# dispatch_retain

Increments the reference count (the retain count) of a dispatch object.

## Declaration

```occ
extern void dispatch_retain(dispatch_object_t object);
```

## Parameters

- `object`: The object to retain. This parameter cannot be NULL.

## Discussion

Discussion Calls to this function must be balanced with calls to dispatch_release. If  multiple subsystems of your application share a dispatch object, each subsystem should call dispatch_retain to register its interest in the object.  The object is deallocated only when all subsystems have released their interest in the dispatch source. Note that your application does not need to retain or release the global (main and concurrent) dispatch queues. important: If your app is built with a deployment target of macOS 10.8 and later or iOS v6.0 and later, dispatch queues are typically managed by ARC, so you do not need to retain or release the dispatch queues. For compatibility with existing code, this behavior is configurable. See GCD Objects and Automatic Reference Counting for details.

## See Also

### Managing Memory

- [dispatch_release](dispatch/dispatch_release.md)
- [dispatch_set_finalizer_f](dispatch/dispatch_set_finalizer_f.md)
