---
title: "CFAllocatorAllocate(_:_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfallocatorallocate(_:_:_:)"
---

# CFAllocatorAllocate(_:_:_:)

Allocates memory using the specified allocator.

## Declaration

```swift
func CFAllocatorAllocate(_ allocator: CFAllocator!, _ size: CFIndex, _ hint: CFOptionFlags) -> UnsafeMutableRawPointer!
```

## Parameters

- `allocator`: The allocator to use to allocate the memory. Pass NULL or kCFAllocatorDefault to use the current default allocator.
- `size`: The size of the memory to allocate.
- `hint`: A bitfield containing flags that suggest how memory is to be allocated. 0 indicates no hints. No hints are currently defined, so only 0 should be passed for this value.

## Return Value

Return Value A pointer to the newly allocated memory.

## See Also

### Managing Memory with an Allocator

- [CFAllocatorDeallocate(_:_:)](corefoundation/cfallocatordeallocate(_:_:).md)
- [CFAllocatorGetPreferredSizeForSize(_:_:_:)](corefoundation/cfallocatorgetpreferredsizeforsize(_:_:_:).md)
- [CFAllocatorReallocate(_:_:_:_:)](corefoundation/cfallocatorreallocate(_:_:_:_:).md)
