This repository was archived by the owner on Jul 13, 2026. It is now read-only.
fix: memory-leak due to unbound type-parameter recursion#320
Closed
PatrickHaecker wants to merge 1 commit into
Closed
fix: memory-leak due to unbound type-parameter recursion#320PatrickHaecker wants to merge 1 commit into
PatrickHaecker wants to merge 1 commit into
Conversation
PatrickHaecker
marked this pull request as draft
July 5, 2026 04:40
Author
|
I wanted to bring this PR out, before the OOM manager is doing its work again. However, turned out, that this does not reliably enough solve the overall problem. I'll check what the the remaining problem is. Setting to draft until I can confirm, that memory usage is sane again on my machine. |
FakeTypeName expanded a type's parameters recursively with no size bound. A few types explode into enormous trees: type-domain packages whose types recurse into themselves (e.g. TypeDomainNaturalNumbers — naturals as nested types, rationals as continued fractions), and even some Base/LinearAlgebra signatures whose `where`-bounded `Union`s reach tens of thousands of nodes. This produced multi-gigabyte cache files (2.2 GB for TypeDomainNaturalNumbers) that exhausted memory — OOMing the machine — when read back into the store. Cap expansion with a per-type budget of expanded DataTypes (MAX_EXPANDED_TYPES = 128): once it is spent, a type's remaining parameters are dropped and only its name is kept. The budget bounds any shape of explosion (depth, width, or indirect recursion through variable bounds), while ordinary types stay far below it and are unaffected.
PatrickHaecker
force-pushed
the
memory_leak_unbounded_recursion
branch
from
July 5, 2026 06:25
ed3c425 to
221294f
Compare
Member
|
This package is deprecated, we moved all the functionality into JuliaWorkspaces.jl. If this is also an issue there (presumably it is), then it would make most sense to have a PR over there. |
Author
|
Thanks, @davidanthoff. I really lost track with all the components involved in the VS Code plugin. Closing this here and trying to carry over the fix. |
Author
|
@davidanthoff, ok, done: JuliaWorkspaced#112 |
pfitzseb
pushed a commit
to julia-vscode/JuliaWorkspaces.jl
that referenced
this pull request
Jul 6, 2026
FakeTypeName expanded a type's parameters recursively with no size bound. A few types explode into enormous trees: type-domain packages whose types recurse into themselves (e.g. TypeDomainNaturalNumbers — naturals as nested types, rationals as continued fractions), and even some Base/LinearAlgebra signatures whose `where`-bounded `Union`s reach tens of thousands of nodes. This produced multi-gigabyte cache files (2.2 GB for TypeDomainNaturalNumbers) that exhausted memory — OOMing the machine — when read back into the store. Cap expansion with a per-type budget of expanded DataTypes (MAX_EXPANDED_TYPES = 128): once it is spent, a type's remaining parameters are dropped and only its name is kept. The budget bounds any shape of explosion (depth, width, or indirect recursion through variable bounds), while ordinary types stay far below it and are unaffected. Add a regression test. Ported from julia-vscode/SymbolServer.jl#320 (SymbolServer.jl is deprecated; the code now lives here under shared/symbolserver/).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FakeTypeNameexpanded nested type parameters without a depth limit, so type-domain packages (e.g.TypeDomainNaturalNumbers.jl) produced multi-GB cache files that exhausted memory on load OOMing the machine.To fix this, cap recursion at
MAX_TYPE_PARAMETER_DEPTH(25), storing the type name only past that depth, and add a regression test.@davidanthoff: This is kind of an "Make VS Code work again" fix, because without it, VS Code was getting closer and closer to being unusable for the last weeks. It seemed to worsen over time, so pressure was large enough to check how to fix this.
Claude Opus 4.8 helped in developing this fix