---
title: CFAllocatorGetDefault()
framework: corefoundation
role: symbol
role_heading: Function
path: corefoundation/cfallocatorgetdefault()
---

# CFAllocatorGetDefault()

Gets the default allocator object for the current thread.

## Declaration

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

## Return Value

Return Value A reference to the default allocator for the current thread. If none has been explicitly set, returns the generic system allocator, kCFAllocatorSystemDefault. Ownership follows The Get Rule.

## Discussion

Discussion See the discussion for CFAllocatorSetDefault(_:) for more detail on the default allocator and for advice on how and when to set a custom allocator as the default.

## See Also

### Getting and Setting the Default Allocator

- [CFAllocatorSetDefault(_:)](corefoundation/cfallocatorsetdefault(_:).md)
