Describe the bug
High memory usage when sending lots of commands for rust from js.
Reproduction
Invoke a command in an interval:
setInterval(() => {
invoke<number[][]>('get_data', args).then(drawOnHtmlCanvasElement)
}, 50)
Return large amount of data from rust to js:
#[tauri::command]
fn get_data(path: &str, start: u64, length: usize, filters: Vec<FilterConfig>) -> Vec<Vec<f32>> {
vec![vec![0.0; 2560]; 21]
// data::get(path, start, length, filters)
}
After several thousand invocations, watch memory usage creep up:

Eventually, when memory pressure is sufficient, the usage plateaus. It appears that garbage collection runs regularly, reducing the memory usage of both the processes that hog memory.
Expected behavior
I would expect the app to run without hogging memory resources.
Platform and versions
> [email protected] tauri
> tauri "info"
Environment
› OS: Mac OS 12.2.1 X64
› Node.js: 16.13.1
› npm: 8.1.2
› pnpm: Not installed!
› yarn: Not installed!
› rustup: 1.24.3
› rustc: 1.57.0
› cargo: 1.57.0
› Rust toolchain: stable-aarch64-apple-darwin
Packages
› @tauri-apps/cli [NPM]: 1.0.0-rc.9
› @tauri-apps/api [NPM]: 1.0.0-rc.4
› tauri [RUST]: 1.0.0-rc.8,
› tauri-build [RUST]: 1.0.0-rc.7,
› tao [RUST]: 0.8.3,
› wry [RUST]: 0.15.1,
App
› build-type: bundle
› CSP: unset
› distDir: ../build
› devPath: http://localhost:3000/
› framework: React
App directory structure
├─ node_modules
├─ public
├─ src-tauri
├─ build
├─ .git
└─ src
Stack trace
Additional context
The get_data command only needs 5ms on my machine. That means the interval is not running too fast, since it has > 40ms of rest time between invocations.
Describe the bug
High memory usage when sending lots of commands for rust from js.
Reproduction
Invoke a command in an interval:
Return large amount of data from rust to js:
After several thousand invocations, watch memory usage creep up:

Eventually, when memory pressure is sufficient, the usage plateaus. It appears that garbage collection runs regularly, reducing the memory usage of both the processes that hog memory.
Expected behavior
I would expect the app to run without hogging memory resources.
Platform and versions
Stack trace
Additional context
The
get_datacommand only needs 5ms on my machine. That means the interval is not running too fast, since it has > 40ms of rest time between invocations.