<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFGetRetainCount(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@F@CFGetRetainCount"
  },
  "title" : "CFGetRetainCount(_:)"
}
-->

# CFGetRetainCount(_:)

Returns the reference count of a Core Foundation object.

```
func CFGetRetainCount(_ cf: CFTypeRef!) -> CFIndex
```

## Parameters

`cf`

The CFType object to examine.

## Return Value

A number representing the reference count of `cf`.

## Discussion

You increment the reference count using the [`CFRetain`](/documentation/CoreFoundation/CFRetain) function, and decrement the reference count using the [`CFRelease`](/documentation/CoreFoundation/CFRelease) function.

This function may be useful for debugging memory leaks. You normally do not use this function, otherwise.

---

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)