RUNLOCALAIv38
->Will it run?Best GPUCompareTroubleshootStartLearnPulseModelsHardwareToolsBench
Run check
RUNLOCALAI

Independently operated catalog for local-AI hardware and software. Hand-written verdicts. Source-cited claims. Reproducible commands when we have them.

OP·Eruo Fredoline
DIR
  • Models
  • Hardware
  • Tools
  • Benchmarks
TOOLS
  • Will it run?
  • Compare hardware
  • Cost vs cloud
  • Choose my GPU
  • Prompting kits
  • Quick answers
REF
  • All buyer guides
  • Learn local AI
  • Methodology
  • Glossary
  • Errors KB
  • Trust
EDITOR
  • About
  • Author
  • How we make money
  • Editorial policy
  • Contact
LEGAL
  • Privacy
  • Terms
  • Sitemap
MAIL · MONTHLY DIGEST
Get monthly local AI changes
Monthly recap. No spam.
DISCLOSURE

Some links on this site are affiliate links (Amazon Associates and other first-class retailers). When you buy through them, we earn a small commission at no extra cost to you. Affiliate links do not influence our verdicts — there are cards we rate highly that we don't have affiliate relationships with, and cards that sell well that we refuse to recommend. Read more →

© 2026 runlocalai.coIndependently operated
RUNLOCALAI · v38
  1. >
  2. Home
  3. /Learn
  4. /How-to
  5. /How to stop a running model and free up memory
HOW-TO · INF

How to stop a running model and free up memory

beginner·5 min·By Eruo Fredoline
Target environment
Ubuntu 24.04 · Ollama 0.4.x
PREREQUISITES

Ollama running with a model currently loaded in memory

What this does

Unloads an active model from RAM or VRAM, reclaiming system memory for other processes. After completing this guide the model will no longer consume resources on the host.

Steps

  1. Exit interactive mode gracefully. Ends the current inference session without disrupting the server.

    >>> /bye
    

    Expected output: Shell prompt returns; ollama ps shows no running models.

  2. Stop the Ollama service entirely. Halts all loaded models at once and frees all associated memory.

    sudo systemctl stop ollama
    

    Expected output: No output; systemctl status ollama shows "inactive (dead)".

  3. Force immediate model unload via API. Useful when a remote client is holding the model open.

    curl -X POST http://localhost:11434/api/generate -d '{"model": "llama3.2", "keep_alive": 0}'
    

    Expected output: A JSON response with "done": true and the model unloaded.

  • Record the local run evidence. Save the exact command, runtime or package version, model name if applicable, and observed output so the result can be reproduced later.

Verification

ollama ps
# Expected: empty output (no running models)
# Then: free -h shows increased MemAvailable compared to before unloading

Common failures

  • /bye not recognized - Not in an interactive Ollama session; press Ctrl+D or Ctrl+C to exit first.
  • service stop affects other users - All active model sessions terminate simultaneously; notify other users before stopping.
  • keep_alive 0 not honored - Ollama version may require "keep_alive": "0s" as a string instead of integer 0.
  • model reloads immediately - An external tool or script is automatically re-querying the API, restarting the model.

Operator checkpoint

Before treating this as solved, write down the local runtime, model or package version, hardware/backend if relevant, and the verification output. This keeps the guide useful as a Will-It-Run style decision instead of a one-off command transcript.

Related guides

  • How to run a model in the background as a persistent service
  • How to list all available models on your local Ollama installation
RELATED GUIDES
INF
How to list all available models on your local Ollama installation
INF
How to run a model in the background as a persistent service
← All how-to guidesCourses →