I have a big application written in ReactJS and wants to find out the memory leaks happening in my code. Is there any tool or technique to find the same?
Regards, SJ
const [value, setValue] = useState('checking value...'); useEffect(() => { let isMounted = true; fetchValue(). then(() => { if(isMounted ){ setValue("done!"); // no more error } }); return () => { isMounted = false; }; }, []); In the above code, I've created a boolean variable isMounted , whose initial value is true.
The simplest way to detect a memory leak is also the way you're most likely to find one: running out of memory. That's also the worst way to discover a leak! Before you run out of memory and crash your application, you're likely to notice your system slowing down.
use google chrome's developers tools Profiling memory performance
,
by taking snapshots, Take Heap Snapshot
and do Comparison.
basically take a snapshot before action, then after action and you can check the "Comparison" view to see if anything was detected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With