memory leak with bun --smol
project id: 4c5f2c27-8083-41b1-9c64-a648a88dc7e3
running a basic telegram bot with bun --smol. is there a way to debug this? i can't tell if my code, bun, or railway is in the wrong
7 Replies
Project ID:
4c5f2c27-8083-41b1-9c64-a648a88dc7e3
Solution
It's 100% related to your code and bun
railway can't cause a memory leak
try testing locally/docker and see if the same happens
not so much railway causing a memory leak, but rather measuring it wrong. it has happened to me before (comparing it on railway vs the same dockerfile in a server)
u can log
console.log(heapStats())
with bun
to see memory usagheU can also set an envvar to print stats on program exit
https://bun.sh/docs/project/benchmarking#native-heap-stats
Bun
Benchmarking – Project | Bun Docs
Bun is designed for performance. Learn how to benchmark Bun yourself.
thanks, this helps, i believe it's a bun node-compat problem