@libsql/client embedded replica leaks memory
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
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)
cc @psarna @MarinPostma
maybe linked to: https://ptb.discord.com/channels/933071162680958986/1175813081717280900/1175813081717280900
Yes that looks like it's related. Perhaps it's not embedded replicas, but a local file that causing the leak.