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
- Is there currently a proper way to explicitly free/destroy LiteSVM native memory from Node.js?
- Does LiteSVM expose any cleanup/dispose API internally?
- Is memory expected to stay allocated because of Rust allocator behavior?
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
After execution:
Runtime Context
Node.js: <=22.14.0
TypeScript: 5.3.3
LiteSVM: 1.1.0
Questions