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

# disable

Temporarily disables collections.

```
- (void) disable;
```

## Discussion

Invocations of this method can be nested. To reenable collection, you must send the collector an [`enable`](/documentation/Foundation/NSGarbageCollector/enable) message once for each invocation of this method.

---

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)