# (gc)
[GstarCAD 2011](../../../Index.md) → [Developer Reference](../../%28Developer%20Reference%29.md) → [AutoLISP Reference](../%28AutoLISP%20Reference%29.md) → [LISP Functions](%28LISP%20Functions%29.md)
<a id="178"></a>
## (gc)
---
Collect the garbage in memory.
---
This function frees up memory no longer being used (short for *Garbage Collection*). This function always returns nil.
**Example**
| Code | Returns |
| --- | --- |
| (**gc**) | nil |
**Don't do this:**
(defunc func ()
(setq var "hi")
.
.
.
(setq var nil)
)
**Do this instead:**
(defunc func (/var) \<\= automatically frees memory
(setq var "hi")
.
.
.
)
**Tell me about...**
[(alloc integer)](%28alloc%20integer%29.md)
[(exp number)](%28exp%20number%29.md)
[(mem)](%28mem%29.md)
[LISP Compatibility](../LISP%20Compatibility.md)
[Programming Overview of LISP (LISt Processing) Language](../Programming%20Overview%20of%20LISP%20%28LISt%20Processing%29%20Language.md)
<a id="holding"></a>
## Other versions with matching text
[GstarCAD 2012](../../../../2012/Developer%20Reference/AutoLISP%20Reference/LISP%20Functions/%28gc%29.md)