> ## Documentation Index
> Fetch the complete documentation index at: https://ollm-opencomic-ai-bin-7.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# closeAllDaemons()

> Manually close all running daemon processes

Immediately closes all active daemon processes and clears the daemon pool. This is useful for manual cleanup or when shutting down your application.

## Syntax

```typescript theme={null}
OpenComicAI.closeAllDaemons(): void
```

## Parameters

This method takes no parameters.

## Returns

`void` - This method does not return a value.

## Behavior

* Closes all active daemon processes immediately
* Clears the internal daemon pool completely
* Does not wait for ongoing operations to complete
* Frees all memory used by daemon processes
* Safe to call even if no daemons are running

## Example

```typescript theme={null}
import OpenComicAI from '@opencomic/ai-bin';

// Process multiple images with daemon mode
for (const image of images) {
  await OpenComicAI.upscale({
    input: image,
    output: `upscaled-${image}`,
    daemonMode: true
  });
}

// Clean up all daemons when done
OpenComicAI.closeAllDaemons();
```

## Use cases

### Application shutdown

```typescript theme={null}
process.on('SIGINT', () => {
  console.log('Shutting down...');
  OpenComicAI.closeAllDaemons();
  process.exit(0);
});
```

### After batch processing

```typescript theme={null}
async function processBatch(images) {
  try {
    for (const image of images) {
      await OpenComicAI.upscale({
        input: image,
        output: `upscaled-${image}`,
        daemonMode: true
      });
    }
  } finally {
    // Ensure cleanup even if errors occur
    OpenComicAI.closeAllDaemons();
  }
}
```

### Memory management

```typescript theme={null}
// Process large batches with periodic cleanup
for (let i = 0; i < largeImageArray.length; i++) {
  await OpenComicAI.upscale({
    input: largeImageArray[i],
    output: `upscaled-${i}.jpg`,
    daemonMode: true
  });
  
  // Close daemons every 100 images to manage memory
  if (i % 100 === 0) {
    OpenComicAI.closeAllDaemons();
  }
}
```

## Important notes

* Does not interrupt currently processing images
* Daemons will be recreated automatically on next upscale operation
* Use this for explicit cleanup; daemons also close automatically based on idle timeout

## Related

* [setConcurrentDaemons()](https://ollm-opencomic-ai-bin-7.mintlify.site/api/set-concurrent-daemons.md) - Control concurrent daemon count
* [setDaemonIdleTimeout()](https://ollm-opencomic-ai-bin-7.mintlify.site/api/set-daemon-idle-timeout.md) - Configure automatic cleanup
* [Daemon mode guide](https://ollm-opencomic-ai-bin-7.mintlify.site/guides/daemon-mode.md) - Learn about daemon mode

## Source

Defined in index.mts:787-797


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.