Critical macOS Crash & 40GB Memory Exhaustion Caused by Recursive Workspace Indexing During Next.js Build

Hi Team,

With latest Anti Gravity IDE update (Antigravity IDE Version: 2.0.3).I am facing repeated critical stability issues with Antigravity IDE / Gemini agent workflows on macOS during implementation tasks.

Issue Summary:

  • The IDE/agent consumes excessive memory (>40 GB swap usage) and eventually freezes/crashes the entire Mac.

  • This has happened multiple times.

  • The latest crash occurred while the agent executed npm run build for a Next.js frontend project.

Observed Root Cause:
The issue appears to be caused by aggressive recursive indexing + filesystem watching across very large monorepo dependency/build directories.

Workspace characteristics:

  • Multiple nested node_modules

  • Python venv

  • Next.js .next build cache

  • Total file count exceeds ~120k files

What likely happens:

  1. The IDE/language server recursively scans and indexes large dependency directories (node_modules, venv, .next).

  2. During next build (Turbopack), thousands of files are continuously generated inside .next.

  3. The IDE watcher reacts to every generated file and repeatedly triggers indexing/background analysis.

  4. This creates a feedback loop:

    • build writes files

    • watcher detects changes

    • indexer rescans

    • CPU/RAM spikes

  5. macOS starts swapping aggressively (>40 GB swap observed), UI freezes, and system crashes.

Why this is concerning:

  • The crash affects the entire operating system, not just the IDE.

  • Background indexing/watcher behavior does not appear to safely throttle or exclude heavy generated folders automatically.

  • This makes the IDE unsafe to use for large monorepos with Next.js/Python environments.

Temporary Mitigation:
I manually added watcher exclusions for:

  • node_modules

  • venv

  • .next

  • .swc

  • dist

  • __pycache__

This reduced the issue significantly.

Request:
Please investigate:

  1. Recursive indexing behavior in large monorepos

  2. File watcher handling during active build processes

  3. Automatic exclusion handling for generated/dependency folders

  4. Memory throttling/backpressure for language servers and watchers

  5. Safe handling of Next.js/Turbopack build output

It would also help if the IDE:

  • automatically respected nested .gitignore

  • auto-excluded common heavy folders

  • paused indexing during build storms

  • exposed watcher/indexing diagnostics in UI

Environment:

  • macOS

  • Next.js 16 + Turbopack

  • Python virtual environments

  • Monorepo workspace structure

This issue is reproducible and severe enough to crash the full machine.

Thanks.

Same issue it used 130gb of ram 60gb of swap

"files.exclude": {
    "**/.git": true,
    "**/.svn": true,
    "**/.hg": true,
    "**/CVS": true,
    "**/.DS_Store": true,
    "**/node_modules": true,
    "**/venv": true,
    "**/.venv": true,
    "**/.next": true,
    "**/.swc": true,
    "**/.pytest_cache": true,
    "**/__pycache__": true,
    "**/*.pyc": true,
    "**/dist": true,
    "**/build": true,
    "**/target": true,
    "**/out": true,
    "**/.gradle": true,
    "**/.cache": true,
    "**/.turbo": true,
    "**/.yarn": true,
    "**/.mypy_cache": true,
    "**/.ruff_cache": true,
    "**/.nuxt": true,
    "**/.svelte-kit": true,
    "**/.astro": true,
    "**/.terraform": true,
    "**/coverage": true
  },
  "search.exclude": {
    "**/node_modules": true,
    "**/venv": true,
    "**/.venv": true,
    "**/.next": true,
    "**/.swc": true,
    "**/.pytest_cache": true,
    "**/__pycache__": true,
    "**/*.pyc": true,
    "**/dist": true,
    "**/build": true,
    "**/target": true,
    "**/out": true,
    "**/.gradle": true,
    "**/.cache": true,
    "**/.turbo": true,
    "**/.yarn": true,
    "**/.mypy_cache": true,
    "**/.ruff_cache": true,
    "**/.nuxt": true,
    "**/.svelte-kit": true,
    "**/.astro": true,
    "**/.terraform": true,
    "**/coverage": true
  },
  "files.watcherExclude": {
    "**/.git/objects/**": true,
    "**/.git/subtree-cache/**": true,
    "**/node_modules/**": true,
    "**/venv/**": true,
    "**/.venv/**": true,
    "**/.next/**": true,
    "**/.swc/**": true,
    "**/.pytest_cache/**": true,
    "**/__pycache__/**": true,
    "**/*.pyc": true,
    "**/dist/**": true,
    "**/build/**": true,
    "**/target/**": true,
    "**/out/**": true,
    "**/.gradle/**": true,
    "**/.cache/**": true,
    "**/.turbo/**": true,
    "**/.yarn/**": true,
    "**/.mypy_cache/**": true,
    "**/.ruff_cache/**": true,
    "**/.nuxt/**": true,
    "**/.svelte-kit/**": true,
    "**/.astro/**": true,
    "**/.terraform/**": true,
    "**/coverage/**": true
  },
  "typescript.tsserver.maxTsServerMemory": 4096,
  "python.analysis.exclude": [
    "**/node_modules",
    "**/venv",
    "**/.venv",
    "**/.next",
    "**/.pytest_cache",
    "**/__pycache__",
    "**/.mypy_cache",
    "**/.ruff_cache"
  ]

As a workaround, try adding this in user settings json of anti gravity.

Hi @Karan_V,

Thank you for reporting. This issue is resolved in Antigravity IDE 2.0.4. Please update to the latest version and let us know if you encounter any further issues.