Skip to content

High RSS memory usage in Node.js/TypeScript — LiteSVM memory not released after simulation #345

Description

@Kiranchaudhary537

Overview

I'm using LiteSVM from Node.js with TypeScript for Solana transaction simulation workloads.

The main issue is that LiteSVM appears to hold a large amount of RSS memory even after simulation execution is completed and the JS object is no longer needed.

Since LiteSVM memory allocation happens outside the V8 heap (Rust/native memory), Node.js GC only releases heap memory while RSS remains high.

I'm trying to run this on small VMs where transactions are simulated continuously, so memory needs to be released aggressively after each simulation request.

Example

const simulate = () => {
  const svm = new LiteSVM()
    .withBlockhashCheck(false)
    .withSigverify(false)
    .withDefaultPrograms()
    .withNativeMints()
    .withSysvars()
    .withBuiltins()
    .withPrecompiles();

    //here. account state loading  

  return svm.simulateTransaction(...);
};

After execution:

  • JS heap gets cleaned
  • RSS memory stays high
  • Memory usage keeps growing under load
  • Eventually process memory becomes problematic on small VMs

Runtime Context

Node.js: <=22.14.0
TypeScript: 5.3.3
LiteSVM: 1.1.0

Questions

  1. Is there currently a proper way to explicitly free/destroy LiteSVM native memory from Node.js?
  2. Does LiteSVM expose any cleanup/dispose API internally?
  3. Is memory expected to stay allocated because of Rust allocator behavior?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions