Repository navigation
Memory limits for programs and the language server, import completion - #17
Merged
Merged
Conversation
… complete import paths Programs stop with an out of memory error when they keep more than 3/4 of the computer's memory alive (BURN_MAX_HEAP_MB), on bvm and in native executables. burn lsp caps its own address space at 4 GiB on Linux (BURN_LSP_MEMORY_MB). The language server completes import paths: standard modules, the project's packages and their files, and local files. An ambiguous name no longer also reports that it cannot be found. The VS Code extension finds burnup's ~/.burn/bin/burn and gives the server a PATH that contains it.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This follows up on a report that the language server crashed in VS Code and then took the whole PC down. Nothing leads that far anymore: every path that can use too much memory now has a limit.
What I found
Checker: 26,743 mutated sources (truncated, token-inserted, spliced), each checked under a 1 GB limit, produced no hang, crash or memory blow-up. Synthetic shapes such as long
??and?.chains, deep nesting, long expressions and many globals all scale linearly.Language server: I drove it like an editor over every example and stdlib file (typing character by character, with hover, completion, definition, symbols, formatting and code actions at random positions). It stays at 4–9 MB and answers every request.
Where the danger actually is:
The last two are fixed in Never build from a language server start, lock installs, refuse shim links burnup#3 and Never start burn-analyzer from itself burn-analyzer#5.
Changes
Heap limit for programs: a program that keeps more than 3/4 of the computer's memory alive now stops with
runtime error: out of memory …and a help line. SetBURN_MAX_HEAP_MBto change the limit, or0to turn it off. This works on bvm and in native executables. The GC also collects before the limit is crossed, not after the heap has doubled.Language server cap:
burn lspcaps its own address space at 4 GiB on Linux (BURN_LSP_MEMORY_MB,0turns it off). If anything ever goes wrong, only the server stops.Import completion: completion inside
import "..."andimport ( ... )offers standard modules, this project and its packages (including files inside a package) and local files, without offering the current file.Ambiguous names: they no longer also report "cannot find".
VS Code (
editors/vscode):burn.pathisn't set, the extension uses burnup's~/.burn/bin/burnif it exists.~/.burn/binonPATH, in the workspace folder.VS Code started from the desktop often doesn't have
~/.burn/binon itsPATH, so it picked up an olderburnwithout package support, which explains libraries not being recognized. The same change is in Find burnup's burn and put it on the language server's PATH vscode-burn#8.Docs: the new variables are documented, and there's a Neovim/LazyVim section in the editors page.
Tests
cargo test --releasepasses normally and withBVM_HOT=1, and clippy is clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01PCXUjgpGnka9y7AHKfnN3w
Generated by Claude Code