-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Which project does this relate to?
Start
Describe the bug
I'm experiencing a significant memory leak when using TanStack Form with Start in production. It crashes my production server every 30 minutes because memory is not being cleaned up for pages that utilize any form.
This issue may also affect other packages. I focused on creating a reproducer with TanStack Form since it's commonly used.
Your Example Website or App
https://github.com/checkerschaf/tanstack-start-form-memory-leak
Steps to Reproduce the Bug or Issue
Setup the project
- Run
npm install - Run
npm run build - Run
npm run start
How to get the heap snapshots
Open http://localhost:3000/form to load the page once and get the base memory usage.
Then open http://localhost:3000/heap-snapshot to get the heap snapshot.
Run the script to load the page 10000 times:
oha http://localhost:3000/form -n 10000 -c 100Then open http://localhost:3000/heap-snapshot to get the heap snapshot.
How to analyze the heap snapshots
Open the heap snapshot in Chrome DevTools and click on the "Memory" tab.
Load both snapshots and compare the differences.
Sort by "Size Delta" to see the biggest differences first. Clicking on the row will show that there is still a reference to many objects that are not being garbage collected.
This is not happening on other routes like /posts.
Expected behavior
No memory leak 😄
Other pages, such as /posts, do not leak much memory.
Screenshots or Videos
Platform
- Start Version: 1.134.9
- OS: macOS
- Form: 1.23.8
Additional context
No response