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 literally never freed1 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 creation patterns compound and result in a lot of duplicated or unused memory. Let’s dig deeper. I’ll run tsgo on a large nextjs project with Zod, tRPC, Drizzle, all the good stuff that makes the typechecker do work. Including node_modu
5/27/2026 · 5,302 views Why does tsgo use so much memory? {pubDate.toString()} } --> 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 literally never freed 1 It’s not uncommon for Typescript projects to have: several th
Explore this link on the map →related reading
- abseil / Performance Hintsabseil.io
- Frequently Asked Questions (FAQ) - The Go Programming Languagego.dev
- Memory Allocation in Go | Melatoninghiant3223.github.io
- NYSRGnotes.ekzhang.com
- TypeScript Structured Concurrencythecandidstartup.org
- TypeScript: Documentation - The Basicstypescriptlang.org
- TypeScript: Documentation - TypeScript for the New Programmertypescriptlang.org
- Reading 14: Concurrencyweb.mit.edu
- To Thread or Not to Thread: An In-Depth Look at Ruby’s Execution Models - Shopifyshopify.engineering
- A Guide to the Go Garbage Collector - The Go Programming Languagego.dev
- Pyrefly vs. ty: Comparing Python’s Two New Rust-Based Type Checkers | Edward Li's Blogblog.edward-li.com
- "We're building a new static type checker for Python" | Hacker Newsnews.ycombinator.com