0

I have a simple app with one button (just for testing) and the memory usage in the application is about 83 MB. Here is My Code. I am wondering that the app size is about 18MB and it's using a lot of memory. this is the same problem in a real app where the memory usage is about 190 MB and increases over time as I navigate in the app and after some time the app is going to stick on the android device have memory less or equal to 1GB and on iPhone 6 real device.

import React, { useCallback, useEffect } from 'react';
    import {Text, TouchableOpacity , View} from 'react-native'
    import SplashScreen from 'react-native-splash-screen';
    
    function Foo () {
        useEffect(() => {
            SplashScreen.hide()
        },\[\])
       
      
      const handleClick = useCallback(() =>  {
          console.log('Click happened');
        },\[\])
      
        
          return (
                <View style={{flex:1, width:'100%',justifyContent:"center", alignItems:"center", height:"100%"}}>
                    <TouchableOpacity 
                        style={{
                            backgroundColor:"gray",
                            borderRadius:10,
                            justifyContent:"center",
                            alignItems:"center", 
                            width:"80%", 
                            height:50
                        }} onPress={() => handleClick()}>
                            <Text style={{color:"#fff", fontWeight:"bold"}}>Click</Text>
                    </TouchableOpacity>
                </View>
          )
      
      }
    
      export default Foo;

Here is the screenshot of the android studio

2
  • Read about memory leak in js example; stackoverflow.com/questions/59780268/… Commented Jul 31, 2021 at 5:57
  • there is no memory leak. for the example in my question but still high memory usage and increasing with .1MB per button click. Commented Jul 31, 2021 at 6:03

0

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.