These two days, doctors have finished the first edition, and they are testing. The code in the project is very messy because the last project was written by the last health management guard. So in the end the doctor, you try to the necessary modules of the package, for example, a network request prompt box for the two time package based on the original three party library, and the network layer completely pulled out, to facilitate unified management.
But recently, tests revealed that there were serious memory leaks and circular references that occurred. ((at O / /~~block used on) a bit messy.)
It’s a three step…
, 1, and first, forget to add when using member variables in block
__weak typeof (self) weakself = self;
Caused by the object can not be released in time, resulting in a circular reference. (forgive me make mistakes (white / at o at /~~), the follow-up to study learning related knowledge).
2, and there is the use of AFNetworking3.0 in the project, I carried out on this basis, packaging, packaging, the use of methods, problems. (well, for the first try, sure enough, there are lots of holes… =).
that’s probably true,
analysis of leakage points are basically related to the network part, well, it seems that the package is really a problem.
to have a look at the official AFNetworking demo, on the Internet for a data package found when the basic use is the singleton pattern to create AFHTTPSessionManager. And each time I use the package, I create a AFHTTPSessionManager, like this:
Well, it should be the problem here, and then change the request to singleton mode. Really changed to a single example mode, the memory leak point, there is only one instant, and instantly feel a lot of clarity in the world.
(but there is one to do, see, and feel good about a fork that this is. OCD. All right, only go on and check which one went wrong..
A call Tree is like this, was ignorant moss… What is this error in..main how to play this
OK, point into a look inside AppDelegate guess where wrong. But step by step investigation. ()
well, finally, locate the link in the cloud,
The explanation for Rong Yun is this:
Well, after testing, link to cloud this step. On the connection case, there will always appear that memory leak point, fail or shield this part when there is no memory leak. (who have encountered this situation, seeking advice. (PS.) to solve this problem, after the update to the latest version of the Rongyun memory leak point has been resolved. Now all green)
To improve (at / O at /~~..)