13

I am creating a App that uses React Native in some part, but not all.

I have an instance of RCTRootView

Setting it to nil and removing it from the superview doesn't seem to release it.

The CPU and RAM stays high, so it seems the React app stills executing on the threads.

How can I stop it?

Thanks :)

2
  • More Info: [Bridge] Deallocating memory when popping ViewController that contains React Native component #1487 github.com/facebook/react-native/issues/1487 Commented Dec 10, 2015 at 5:52
  • Did you try a autoReleasePool ? Commented Dec 18, 2015 at 6:29

2 Answers 2

5
RCTBridge * bridge
[bridge invalidate];
bridge = nil;

invalidate and nil will clear all modules from jsbundle and it clears RCTRootView instances from memory . Note bridge is object of RCTBridge.

Sign up to request clarification or add additional context in comments.

Comments

4

You have to create your own RTCBridge separately and release it ( = nil), not only the view.

1 Comment

I stumbled on this answer, but unfortunately my memory is still climbing every time I create new RCTRootView. I create my own RCTBridge and my own RCTRootView with it, and stick it inside some UIViewController. When UIViewController goes away, why do we have to set anything to nil? Wouldn't the stack just go away? We are not in pre-ARC days here, what am I missing?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.