# Residency

> USearch for JavaScript

An executor and an index are each built through the residency they drive, so a direct `new usearch.Executor()` or `new usearch.DenseIndex()` throws and names the factories instead.
An index runs its verbs only on an executor of its own residency, and `arena.describe()` reports where an arena's outputs live as `{ residency, device }`, with `device` `null` for host pages.

```javascript
const hostIndex = usearch.DenseIndex.initRam({ dimensions: 128 }, [0, 1]);
const deviceIndex = usearch.DenseIndex.initVram({ dimensions: 128 }, [0, 1]);
const diskIndex = usearch.DenseIndex.viewNvme('index.safegraphs.json', { executor: diskPool, paths: ['/mnt/nvme0', '/mnt/nvme1'] });
```

`initRam` shards over the named NUMA nodes, absent spreading the shards over every node, and `initVram` over the named CUDA ordinals, absent taking one free device.
An NVMe index is never initialized, only served in place from a checkpoint, read-only.
An index's `free()` waits for every deferred call naming it, and a freed index refuses every later call.

`import * as usearch from 'usearch';`

## Residency

Where an executor computes, and so where the arenas it makes keep their memory.

```typescript
enum Residency
```

- `Ram` = `&quot;ram&quot;`: Host memory traversed by CPU threads.
- `Vram` = `&quot;vram&quot;`: Accelerator memory traversed by GPU streams, which no host view reads.
- `Nvme` = `&quot;nvme&quot;`: Persisted memory read through submission rings; its arenas are host pages.

