---
schema_version: "1"
id: a1d778a8f03dee0e2155cf42e93a1fcee7730fbf7ac934586bbd6ce8f6ab28de
title: destroy()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/aura-platform/guides/aura/ref-jsapi/ref-jsapi-component-destroy.md
canonical_url: https://developer.salesforce.com/docs/platform/aura-platform/guide/ref-jsapi-component-destroy.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 269edc5fdb34a236ce0f3d996a02a5efbbb32e7fb654ee9fde29ae97ef4bc339
products:
  - Lightning Aura Components Developer Guide
  - Platform Developer Content
---

# destroy()

Destroys the component and cleans up memory. After a component that is declared in markup is no longer in use, the framework automatically destroys it and frees up its memory. If you create a component dynamically in JavaScript and that component isn't added to a facet (`v.body` or another attribute of type `Aura.Component[]`), you have to destroy it manually using `destroy()` to avoid memory leaks.

## Signature

`destroy()`

