Device memory info

I would like showing current device memory info via import DeviceInfo from ‘@amzn/react-native-device-info’;

I tyr use Sync but I have 0 all time

    const [total, setTotal] = useState<number>(0);
    const [used, setUsed] = useState<number>(0);
    const [free, setFree] = useState<number>(0);

    useEffect(() => {
      const updateMemory = () => {
        try {
          const totalMem = DeviceInfo.getTotalMemorySync(); // bytes
          const usedMem = DeviceInfo.getUsedMemorySync(); // bytes
          setTotal(Math.round(totalMem / (1024 * 1024)));
          setUsed(Math.round(usedMem / (1024 * 1024)));
          setFree(Math.round((totalMem - usedMem) / (1024 * 1024)));
        } catch (e) {
          console.warn('MemoryMonitor error:', e);
        }
      };
      updateMemory(); // first run
      const interval = setInterval(updateMemory, 5000); // every 5 sec
      return () => clearInterval(interval);
    }, []);

and async but I have 0 all time

    const [total, setTotal] = useState<number>(0);
    const [used, setUsed] = useState<number>(0);
    const [free, setFree] = useState<number>(0);

    const fetchMemory = async () => {
      try {
        const totalMem = await DeviceInfo.getTotalMemory(); // bytes
        const usedMem = await DeviceInfo.getUsedMemory(); // bytes

        setTotal(totalMem);
        setUsed(usedMem);
        setFree(totalMem - usedMem);
      } catch (e) {
        console.warn('MemoryMonitor error:', e);
      }
    };

    useEffect(() => {
      fetchMemory(); 
      const interval = setInterval(fetchMemory, 5000); 
      return () => clearInterval(interval);
    }, []);

Have you any idea, how can I to show current device memory info?

Hi @Viktor_Kravchuk ,

Our team will take a look at your request and get back soon.

Thanks,
Rohit

Hi @Viktor_Kravchuk ,

Can you please explain why the device memory info is required and what you intent to do with it?

Thanks,
Rohit

I have performance issues. Sometimes I have out of memory and app is crashing. I would like to show for each page information about memory status on production mode.

Hi @Viktor_Kravchuk ,

Checking in. Is this still an issue for you and if yes, is it a blocker for your development?

Thanks,
Rohit

I would like to use this functionality for deeply understanding “bottleneck” of memory usage. It is not blocker, however nice to have

Hi @Viktor_Kravchuk ,

I would like to let you know that this feature request has been logged with our team as a backlog item.
Currently, we do not have a definite timeline on when this will be available.
However, if it is made available in future, you will be notified via announcements, release notes and tech docs.

Let us know if we can close this post for now. You can always create a new post referrenceing this if required.

Thanks,
Rohit

Hi @Viktor_Kravchuk ,

The vega exec perf memory-monitor --app-name= CLI command provides live memory breakdowns (PSS, USS, JS Heap) for any running app. There’s also a Vega Studio UI Memory Monitor that renders the same data as live graphs. Both can help you identify memory bottlenecks and OOM patterns.
Reference Docs here: Monitor and Record Memory | Design and Develop Vega Apps.

Thanks,
Rohit