<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: 10.5.0 - 10.10.0"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSGarbageCollector/enableCollectorForPointer:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSGarbageCollector(im)enableCollectorForPointer:"
  },
  "title" : "enableCollectorForPointer:"
}
-->

# enableCollectorForPointer:

Specifies that a given pointer may be collected.

```
- (void) enableCollectorForPointer:(const void *) ptr;
```

## Parameters

`ptr`

A pointer to the memory that may be collected.

## Discussion

You use this method to make memory that was previously marked as uncollectable. For example, given the address of the global dictionary created in [`disableCollectorForPointer:`](/documentation/Foundation/NSGarbageCollector/disableCollectorForPointer:), you could make the dictionary collectable as follows:

```objc
[[NSGarbageCollector defaultCollector]
    enableCollectorForPointer:globalDictionary];
```

For more about root objects and scanned memory, see Garbage Collection Programming Guide.

---

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)