There was an online Crash today. The online package kept flashing back after the user opened the APP, but there was no such problem in our development and testing. Later, after Bugly reported the problem, we found the corresponding test package and started to reappear. Find the corresponding component branch, full master specified version real machine test.
The result of running the full master machine is
Message from debugger:Terminated due to memory issue
Copy the code
If you see this error, you probably know that memory inflation was killed by the watchdog
The key is how to screen
Leaks tool in instrument was used to check, but we did not do so. We found that it was killed after entering the APP and passing the main, so we can preliminarily confirm that it was an error on the workbench.
So the main function of the workbench is to load the corresponding permissions, and then configure the menu and other functions. I wonder if it is because of the abnormal data of this customer, we shut down the network, and then enter the workbench, and there will be no Crash.
Then we checked down several requests used by the workbench one by one, and found that there was a function card component in the workbench, which used rich text, and the rich text was loaded according to the data from the back-end.
The backend interface returns a field, whether to use rich text, and then which paragraphs to enable rich text, font, color, and style are determined by the backend.
Because it is a tableView Cell, there is a nested for loop inside, and then each item in it records a bar of rich text. Because the back end returns N items, we only display 4 items, but all of them will be loaded once, resulting in memory explosion.
Finally, record the crash log