---
title: defaultCollector
framework: foundation
role: symbol
role_heading: Type Method
path: foundation/nsgarbagecollector/defaultcollector
---

# defaultCollector

Returns the default garbage collector.

## Declaration

```occ
+ (id) defaultCollector;
```

## Return Value

Return Value The default garbage collector for the current process. Returns nil if the current process is not running with garbage collection.

## Discussion

Discussion There is at most one garbage collector for Cocoa within a single process.
