josephg / node-foundationdb

Modern Node.js FoundationDB bindings
Other
115 stars 17 forks source link

Watch memory leak #82

Closed Snowman2908 closed 2 months ago

Snowman2908 commented 2 months ago

Hi! We noticed a memory leak when using watch Repo for debug: https://github.com/Snowman2908/node-foundationdb-watch-memory-leak

Starting profiling:

app-1           | $ /node_modules/.bin/ts-node index.ts
app-1           | NodeJS heap: 94.99MB
app-1           | Process memory: 290.81MB
app-1           | NodeJS heap: 99.58MB
app-1           | Process memory: 305.81MB
app-1           | NodeJS heap: 102.77MB
app-1           | Process memory: 321.31MB
app-1           | NodeJS heap: 105.6MB

End profiling after 10 min:

app-1           | Process memory: 949.81MB
app-1           | NodeJS heap: 95.78MB
app-1           | Process memory: 963.19MB
app-1           | NodeJS heap: 97.89MB
app-1           | Process memory: 976.06MB
app-1           | NodeJS heap: 97.07MB
app-1           | Process memory: 988.94MB
app-1           | NodeJS heap: 96.43MB
app-1           | Process memory: 1002.56MB
app-1           | NodeJS heap: 100.89MB
app-1           | Process memory: 1016.69MB

The situation is similar to what happened with tn, NodeJS heap size stays at consistent levels, but the total process memory grows

I use macOS with rosetta, but we have the same situation with a memory leak in our services in Kubernetes

Snowman2908 commented 2 months ago

Moved from https://github.com/josephg/node-foundationdb/issues/48

josephg commented 2 months ago

Thanks for the repro! That makes this much less daunting to find & fix. I'll take a look next week. I've been busy with some other work.

Snowman2908 commented 2 months ago

Hi @josephg! I understand correctly that you will release it next week, when will you have free time?