Memory Leak with Reanimated and Expo 42

I’ve run into a strange issue while trying to use react-native-reanimated in my Expo app. Everything seems to work fine with the reanimated hooks but when I try and use any ‘math’ functions it runs out of memory.

To reproduce, spin up a new expo app, add reanimated and in App.tsx add:

import { add } from 'react-native-reanimated'

console.log('add', add(1, 2))

This causes the app to consume 7gb+ of memory and then crash… Sometimes it gives me an error saying it ran out of memory for the console.log, but most of the time it just gives up. The same does not happen in a standard react-native app, where it works fine.

  1. SDK Version: 42
  2. Platforms(Android/iOS/web/all): iOS (only one tested)


Hey @alaister, where are your placing the console.log to reproduce this? If it’s in somewhere that’s going to get called on every re-render in a component that is updating rapidly this is expected. And just to be certain, the crash is occurring when you are simply using the math functions rather than console.logging?


Hey Adam,
I’m placing the console.log right under the import statement outside of any components - and yes it does still crash if it’s just the call to the math function without the console.log.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.