Skip to content

fix(tsx): enable the default memory limit - #993

Merged
houko merged 1 commit into
nsgo-dev:mainfrom
houko:assess/issue760-tsx-memory
Nov 20, 2026
Merged

houko merged 1 commit into
nsgo-dev:mainfrom
houko:assess/issue760-tsx-memory

Conversation

@houko

@houko houko commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • enable the existing TSX memory accounting with a 64 MiB default budget
  • document the default memory limit alongside the other default quotas

Closes #760

@github-actions github-actions Bot added tsx size/XS bug Something isn't working labels Nov 20, 2026
@houko
houko force-pushed the assess/issue760-tsx-memory branch from 9691894 to 3d237dd Compare November 20, 2026 10:29
@github-actions github-actions Bot added size/S documentation Improvements or additions to documentation size/XS conflict Conflicts with the base branch; resolve it first and removed size/XS size/S labels Nov 20, 2026
@houko
houko force-pushed the assess/issue760-tsx-memory branch from 3d237dd to 2a7c773 Compare November 20, 2026 10:51
@github-actions github-actions Bot added size/S conflict Conflicts with the base branch; resolve it first and removed size/XS conflict Conflicts with the base branch; resolve it first labels Nov 20, 2026
@houko
houko force-pushed the assess/issue760-tsx-memory branch from 2a7c773 to 8b6b215 Compare November 20, 2026 12:22
@github-actions github-actions Bot added conflict Conflicts with the base branch; resolve it first and removed conflict Conflicts with the base branch; resolve it first labels Nov 20, 2026
@houko

houko commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

Reviewed.

  • Memory is charged until the Go collector frees it, so with a large host heap a bundle that only allocates and drops 1 MiB buffers was stopped at 64 MiB of garbage. Over the budget, the runtime now runs the collector and releases what it found unreachable before stopping the bundle (TestMemoryCollectsBeforeStopping).
  • Fixed the Limits.Memory doc ("Zero, the default"), the en/zh docs ("off by default") and the DefaultLimits comment; added the CHANGELOG bullet.
  • ./tsx, the memory tests (3 runs) and ./examples/plugins pass; check -target web,linux passes.
  • Note: the wrapped built-ins now run in every sandboxed package by default, about 25% slower on a loop heavy in JSON.stringify and join.

@houko
houko force-pushed the assess/issue760-tsx-memory branch from 8b6b215 to dbf5135 Compare November 20, 2026 13:28
@houko
houko merged commit c70af8a into nsgo-dev:main Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working conflict Conflicts with the base branch; resolve it first documentation Improvements or additions to documentation size/S tsx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tsx: Limits has no memory bound; a sandboxed bundle can exhaust the host process's memory

1 participant