<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSPointerFunctions/Options",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@E@NSPointerFunctionsOptions"
  },
  "title" : "NSPointerFunctions.Options"
}
-->

# NSPointerFunctions.Options

Defines the memory and personality options for an `NSPointerFunctions` object.

```
struct Options
```

## Overview

When specifying a value, you can use only one of the options listed in Memory Options,  only one of the options listed in Personality Options, and any number of other options.

## Topics

### Memory Options

These options are mutually exclusive.

[`NSPointerFunctionsMachVirtualMemory`](/documentation/Foundation/NSPointerFunctions/Options/machVirtualMemory)

Use Mach memory.

[`NSPointerFunctionsMallocMemory`](/documentation/Foundation/NSPointerFunctions/Options/mallocMemory)

Use `free()` on removal, `calloc()` on copy in.

[`NSPointerFunctionsOpaqueMemory`](/documentation/Foundation/NSPointerFunctions/Options/opaqueMemory)

Take no action when pointers are deleted.

[`NSPointerFunctionsStrongMemory`](/documentation/Foundation/NSPointerFunctions/Options/strongMemory)

Use strong write-barriers to backing store; use garbage-collected memory on copy-in.

[`NSPointerFunctionsWeakMemory`](/documentation/Foundation/NSPointerFunctions/Options/weakMemory)

Uses weak read and write barriers appropriate for ARC or GC. Using NSPointerFunctionsWeakMemory object references will turn to `NULL` on last release.

[`NSPointerFunctionsZeroingWeakMemory`](/documentation/Foundation/NSPointerFunctionsOptions/NSPointerFunctionsZeroingWeakMemory)

Use weak read and write barriers; use garbage-collected memory on copyIn.

[`NSMapTableStrongMemory`](/documentation/Foundation/NSMapTableStrongMemory)

Equivalent to [`strongMemory`](/documentation/Foundation/NSPointerFunctions/Options/strongMemory).

[`NSMapTableWeakMemory`](/documentation/Foundation/NSMapTableWeakMemory)

Equivalent to [`weakMemory`](/documentation/Foundation/NSPointerFunctions/Options/weakMemory).

[`NSMapTableZeroingWeakMemory`](/documentation/Foundation/NSMapTableZeroingWeakMemory)

Equivalent to [`NSPointerFunctionsZeroingWeakMemory`](/documentation/Foundation/NSPointerFunctionsOptions/NSPointerFunctionsZeroingWeakMemory).

### Personality Options

These options are mutually exclusive.

[`NSPointerFunctionsCStringPersonality`](/documentation/Foundation/NSPointerFunctions/Options/cStringPersonality)

Use a string hash and `strcmp`; C-string ‘`%s`’ style description.

[`NSPointerFunctionsIntegerPersonality`](/documentation/Foundation/NSPointerFunctions/Options/integerPersonality)

Use unshifted value as hash and equality.

[`NSPointerFunctionsObjectPersonality`](/documentation/Foundation/NSPointerFunctions/Options/objectPersonality)

Use `hash` and `isEqual` methods for hashing and equality comparisons, use the `description` method for a description.

[`NSPointerFunctionsObjectPointerPersonality`](/documentation/Foundation/NSPointerFunctions/Options/objectPointerPersonality)

Use shifted pointer for the hash value and direct comparison to determine equality; use the `description` method for a description.

[`NSPointerFunctionsOpaquePersonality`](/documentation/Foundation/NSPointerFunctions/Options/opaquePersonality)

Use shifted pointer for the hash value and direct comparison to determine equality.

[`NSPointerFunctionsStructPersonality`](/documentation/Foundation/NSPointerFunctions/Options/structPersonality)

Use a memory hash and `memcmp` (using a size function that you must set—see [`sizeFunction`](/documentation/Foundation/NSPointerFunctions/sizeFunction)).

[`NSMapTableObjectPointerPersonality`](/documentation/Foundation/NSMapTableObjectPointerPersonality)

Equivalent to [`objectPointerPersonality`](/documentation/Foundation/NSPointerFunctions/Options/objectPointerPersonality).

### Copy Option

[`NSPointerFunctionsCopyIn`](/documentation/Foundation/NSPointerFunctions/Options/copyIn)

Use the memory acquire function to allocate and copy items on input (see [`acquireFunction`](/documentation/Foundation/NSPointerFunctions/acquireFunction)).

[`NSMapTableCopyIn`](/documentation/Foundation/NSMapTableCopyIn)

Equivalent to [`copyIn`](/documentation/Foundation/NSPointerFunctions/Options/copyIn).

## Relationships

### Conforms To

[`BitwiseCopyable`](/documentation/Swift/BitwiseCopyable)

[`RawRepresentable`](/documentation/Swift/RawRepresentable)

[`Sendable`](/documentation/Swift/Sendable)

[`OptionSet`](/documentation/Swift/OptionSet)

[`Equatable`](/documentation/Swift/Equatable)

[`SetAlgebra`](/documentation/Swift/SetAlgebra)

[`ExpressibleByArrayLiteral`](/documentation/Swift/ExpressibleByArrayLiteral)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

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)