---
title: "content.dispose()"
description: "Release an instance's runtime resources and keep its data."
canonical_url: "https://content.comark.dev/reference/content/dispose"
---
# content.dispose()

> Release an instance's runtime resources and keep its data.

## `content.dispose()`{lang="ts"}

Releases the instance's runtime resources: stops every watcher started by [`watch()`](https://content.comark.dev/reference/content/watch), runs plugin `onDispose` callbacks in reverse setup order, and removes every hook. Persisted data is kept, so the next instance over the same cache driver restores it.

```ts [dispose.ts]
await content.dispose()
content.status // 'disposed'
```

### Returns

`Promise<void>`{lang="ts"}

## Behaviour

- **Idempotent.** A second call does nothing.
- **Terminal.** [`status`](https://content.comark.dev/reference/content/status) becomes `'disposed'`; [`init()`](https://content.comark.dev/reference/content/init) and every read that needs it throw afterwards. Create a new instance instead.
- **Keeps the data.** Nothing is removed from the cache. Use [`clean()`](https://content.comark.dev/reference/content/clean) to delete an instance's data as well.
- **Hub.** `hub.dispose()` disposes every composed instance.

Use it when you replace an instance, for example when a [pinned instance](https://content.comark.dev/reference/content/with-ref) is swapped for a newer commit, or when a preview instance is evicted from a memo. Plugins that hold timers, connections, or subscriptions register their release with `content.onDispose(fn)` in `setup()`.


## Sitemap

See the full [sitemap](https://content.comark.dev/sitemap.md) for all pages.
