jaredpalmer / formik

Build forms in React, without the tears 😭
https://formik.org
Apache License 2.0
33.87k stars 2.78k forks source link

Memory leak with nested attribute names and template literals #2599

Open AdnanTheExcellent opened 4 years ago

AdnanTheExcellent commented 4 years ago

πŸ› Bug report

I am getting a memory leak in formik and I do not know whats causing it. I tried various workarounds but nothing seems to prevent the leak from happening.

Current Behavior

The memory leak triggers when i start typing in any input in the form. If you watch memory usage (i've been using firefox), you can see that the process goes up to around 3-4gb before the browser asks to stop it or wait.

crashing firefox (example takes me ~10-20 seconds for memory leak to trigger): image

crashing edge (example takes me 20-30 seconds for memory leak to trigger): image

crashing in chrome (example takes me ~ 1 minute for memory leak to trigger) image

Expected behavior

no memory leak

Reproducible example

https://codesandbox.io/s/optimistic-brown-0q6re?file=/App.tsx

this codebox example takes about 10-20 seconds for the memory leak to creep up for the firefox dialog to show. Longer in edge and chrome. my actual code which has many more inputs triggers it within 1 second.

Your environment

Software Version(s)
Formik 2.1.4
React 16.13
TypeScript 3.8.2
Browser firefox 78.0.2
npm/Yarn 11.1.0 / 1.13.0
Operating System windows 10
AdnanTheExcellent commented 3 years ago

Bump. this is still an issue for me. @jaredpalmer my codesandbox example still triggers some sort of memory leak on all browsers. any idea whats causing it or how to get around the leak?