tursodatabase / libsql-client-ts

TypeScript/JavaScript client API for libSQL

Home Page:https://docs.turso.tech/sdk/ts/quickstart

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@libsql/client embedded replica leaks memory

khuezy opened this issue · comments

Hi! There is a major memory leak when using embedded replicas (calling client.sync and then making any query on the client).
The reproduction repo is here with instructions.

Here is a screenshot of the Fly container memory (using sync)
At the 13:24:00 mark, the load test is executed. Memory continues to grow and flat lines after the test ends (most of the memory is never released).
NOTE: and 2nd container was created (13:27:00) b/c the 1st almost ran out of memory
image

Here is a screenshot of the same app but w/o using embedded replicas:
At the 13:53:00 mark, the load test is executed. Memory never explodes and stays leveled. At the end of the test, the memory is freed (there's a slight difference from the start/end, but that's just normal node GC behavior... sometimes the ending memory is less than the starting memory)
image (1)

Yes that looks like it's related. Perhaps it's not embedded replicas, but a local file that causing the leak.