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

# CFAllocatorGetDefault()

Gets the default allocator object for the current thread.

```
func CFAllocatorGetDefault() -> Unmanaged<CFAllocator>!
```

## Return Value

A reference to the default allocator for the current thread. If none has been explicitly set, returns the generic system allocator, [`kCFAllocatorSystemDefault`](/documentation/CoreFoundation/kCFAllocatorSystemDefault). Ownership follows [The Get Rule](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-SW1).

## Discussion

See the discussion for [`CFAllocatorSetDefault(_:)`](/documentation/CoreFoundation/CFAllocatorSetDefault(_:)) for more detail on the default allocator and for advice on how and when to set a custom allocator as the default.

---

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)