Open goldo opened 3 months ago
A memory leak is indefinite growth in memory usage. 70 MB -> 100 MB is not clearly a leak. If you can make it go from 70 MB -> 1 GB, and then continue rising after receiving the same request volume then that is a leak.
On the full project, I got this:
What version of Bun is running?
1.1.22-canary.42+bec04c734
What platform is your computer?
Darwin 23.5.0 arm64 arm
What steps can reproduce the bug?
I made a small reproduction project with bun + fastify + prisma (sqlite): https://github.com/goldo/bun-memory
What is the expected behavior?
Memory should be going down, after a while, at approx. the level of the beginning of the server (first request)
What do you see instead?
memory is going down just a little (GC), but stays really high
Additional information
This is a following issue of https://github.com/oven-sh/bun/issues/7377
Investigation of potential bun memory leak
heapStats().objectTypeCounts check:
at the beginning:
after
autocannon -c 30 -d 30 http://localhost:3010
:After a few minutes (waiting for GC), the objectTypeCounts seems still high, and the memory usage is still high (101mb) vs initial (71mb):
The problem seems to be the same with or without the fastify plugin.