<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.6.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Dispatch",
  "identifier" : "/documentation/Dispatch/dispatch_retain",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Dispatch"
    ],
    "preciseIdentifier" : "c:@F@dispatch_retain"
  },
  "title" : "dispatch_retain"
}
-->

# dispatch_retain

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

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

## Parameters

`object`

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

## Discussion

Calls to this function must be balanced with calls to [`dispatch_release`](/documentation/Dispatch/dispatch_release). If  multiple subsystems of your application share a dispatch object, each subsystem should call [`dispatch_retain`](/documentation/Dispatch/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.

---

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)