The application memory developed by React Native accounts for the highest memory of 400MB and steadily accounts for the memory of 360MB. How to optimize it?

[to: reviewer, my screenshot is not code, it"s memory usage.
I"ve only seen Android apps here.

first of all, it takes up memory when app is opened. The occupation of 119MB is not bad.
clipboard.png

tab(5)tab

clipboard.png

The

page has almost no pictures, mainly composed of lists and charts. The list is a flatList, chart that uses webview, to embed a html with its own echart.js script, and then draw the chart in this html.
because it refers to a lot of charts, it"s basically a chart and a webview can be said to be full of webview all over the page. Although I know that this is not a good idea, it is the only feasible plan at present.

looked at the memory analysis, very high. But I don"t know how to optimize it.
what you can do now is that tab is not used as a switch, but as an one-page one. But like this, my data has to be re-sent? It"s not necessary. My data is not time-sensitive.

Optimization solution: open the page and send requests for each page one after another, and the data is cached in redux. Tab pages are not saved on the stack, only one page at a time, so it doesn"t consume a lot of memory, but to be honest, it takes a long time to render a page with a lot of charts.

Mar.24,2021

still try to reduce the number of Webview instances. If the icon is static, you can generate static PNG images or SVG images

.
Menu