> For the complete documentation index, see [llms.txt](https://yutian-chen.gitbook.io/c0vm.ts-dev-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yutian-chen.gitbook.io/c0vm.ts-dev-documentation/general-view/application-configuration.md).

# Application Configuration

Tune the application behavior through these global variables.

### Debug Configuration

| Name              | Type      | Explain                                                                                                                         |
| ----------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `DEBUG`           | `boolean` | When `DEBUG` is set to true, more information will be logged into console to help debug.                                        |
| `DEBUG_DUMP_MEM`  | `boolean` | When `DEBUG_DUMP_MEM` is set to `true`, the heap memory (as an array buffer) will be dumped to the console when VM initializes. |
| `DEBUG_DUMP_STEP` | `boolean` | When `DEBUG_DUMP_STEP` is set to `true`, the VM will log state information to console on each step of execution.                |

### Heap Memory Configuration

| Name                    | Type     | Explain                                                                    |
| ----------------------- | -------- | -------------------------------------------------------------------------- |
| `MEM_POOL_SIZE`         | `number` | Size of heap memory, in bytes                                              |
| `MEM_POOL_DEFAULT_SIZE` | `number` | Default size of heap memory, in bytes                                      |
| `MEM_POOL_MAX_SIZE`     | `number` | Maximum allowed size of heap memory, in bytes                              |
| `MEM_POOL_MIN_SIZE`     | `number` | Minimum allowed size of heap memory, in bytes                              |
| `MEM_BLOCK_MAX_SIZE`    | `number` | Maximum size of a memory block (`alloc` or `alloc_array`)allowed, in bytes |

### C0 Runtime Configuration

| Name               | Type     | Explain                                                                              |
| ------------------ | -------- | ------------------------------------------------------------------------------------ |
| `C0_MAX_RECURSION` | `number` | Maximum call stack depth allowed. If exceeded, the `c0_memory_error` will be thrown. |

### Compiler Configuration

| Name                   | Type     | Explain                                         |
| ---------------------- | -------- | ----------------------------------------------- |
| `COMPILER_BACKEND_URL` | `string` | The remote network URL for backend compile API. |

### UI Configuration

| Name                       | Type                | Explain                                                    |
| -------------------------- | ------------------- | ---------------------------------------------------------- |
| `UI_EDITOR_THEME`          | `"light" \| "dark"` | Theme of Code Mirror code editor (both C0 and BC0 editor)  |
| `UI_ERR_DISPLAY_TIME_SEC`  | `number`            | The amount of time an error message will display (in sec)  |
| `UI_WARN_DISPLAY_TIME_SEC` | `number`            | The amount of time a warning message will display (in sec) |
| `UI_OK_DISPLAY_TIME_SEC`   | `number`            | The amount of time an OK message will display (in sec)     |

### Experimental Features

| Name                | Type      | Explain                                              |
| ------------------- | --------- | ---------------------------------------------------- |
| `EXP_PRESERVE_TYPE` | `boolean` | Preserve the `typeRecord` or not on restarting C0VM. |
