I'm curious about how to use Xcode Instruments for a React Native iOS app. Could you provide some guidance? #132361
Replies: 1 comment
-
|
Instruments + RN can be confusing because a lot of your JS leaks show up under different stacks, and small leaks won't always trigger the Leaks instrument immediately. What I'd do:
If Leaks shows nothing but memory climbs in Allocations, that's still useful — share a screenshot of the call tree and what screen you repeated. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
I am experiencing issues while profiling an iOS app developed with React Native.
I attempted to verify if the memory leak examples purportedly related to React Native would be detected by the Xcode Instruments Leaks template. However, in all cases, no memory leaks were detected.
Is there anyone who can provide a practical example of a memory leak in React Native that can be detected using the Xcode Instruments Leaks template?
Or is there an additional step required to apply the Instruments tool to React Native code?
Currently, I am using React Native 0.74.2 and Xcode 15.2, and my test involved simply running Instruments in Xcode, opening the app with the Leaks template, and conducting the test.
Here is the example code:
const MemoryLeakExample = () => {
useEffect(() => {
const intervalId = setInterval(() => {
console.log('interval is running');
}, 1000);
return () => {
console.log('leak');
};
}, []);
return (
MemoryLeak Example
);
};
Beta Was this translation helpful? Give feedback.
All reactions