WeSearch

Why does tsgo use so much memory?

·8 min read · 0 reactions · 0 comments · 10 views
#typescript#memory#programming
Why does tsgo use so much memory?
⚡ TL;DR · AI summary

The article discusses the high memory usage of tsgo when running on large Typescript projects. It explains that each thread creates its own type checker, leading to duplicated memory allocation. Additionally, the article highlights the significant memory consumption by AST nodes and the type checker itself.

Key facts
Original article
Zackoverflow
Read full at Zackoverflow →
Opening excerpt (first ~120 words) tap to expand

5/27/2026 Why does tsgo use so much memory? If you run tsgo on decently sized Typescript project, it’s not uncommon to see it using gigabytes of memory. Why is that? The short answer is: when multi-threading, tsgo makes a type checker per thread each type checker has its own state (types, symbols, etc.) this state is not shared as synchronizing it between threads is costly so each type checker often allocates duplicate, redundant memory in addition, allocated types are never freed It’s not uncommon for Typescript projects to have: several thousand Typescript files libraries like Zod, tRPC, Drizzle which result in many, many type instantiations recursive generic types which product a lot of transient types which are never freed When running tsgo on a large Typescript project, these type…

Excerpt limited to ~120 words for fair-use compliance. The full article is at Zackoverflow.

Anonymous · no account needed
Share 𝕏 Facebook Reddit LinkedIn Threads WhatsApp Bluesky Mastodon Email

Discussion

0 comments

More from Zackoverflow