The resource loading... loading...

Memory leakage issue (solved)

Author: Shipwrecked 7, Created: 2015-11-30 10:28:10, Updated: 2015-12-02 01:58:48

My own strategy is to have a problem with the increasing memory occupancy, not being able to find the problem in the code, to ask who has experienced similar problems and what solutions are used. In what cases does a memory leak occur, ask for guidance. Is there a way to force memory recovery?

The solution: First, stop creating too many variables in the cycle. 2, Minimize the main function code; 3, as few parameters as possible of the subfunction, retrieved from the exchange, not from the previous level, although many calls are made to the API, but there is no correlation between the functions, the variable memory of the higher level function can be freed as soon as possible; 4, functions for displaying the status of various functions such as Log, LogStatus, etc. should be used separately from the main and ontick functions; 5. For low-speed policies, such as the tsunami, multiple APIs can be used without intentionally reducing the number of calls, which would otherwise lead to too many references and affect memory release.

It may not be all right, but the problem is solved.


More

lengfengThe problem is to find it in the code.

Shipwrecked 7Try not to create variables in the loop. And, after the variables are used, recycle with = null.

lengfengYou can share where the problem is and how to solve it.

Shipwrecked 7Thank you, basically solved.