简体   繁体   中英

Potential Memory Leak in iOS

So I just made an app that loads a map with some markers on it. The app has a navigation controller that segue from the main screen to the map and back. While running the app on my phone and simulator i noticed that if i went back and forth between the home screen and the map, the amount of memory that the app was using just kept growing indefinitely. Is there way to assist in the process of memory management (i know the system uses ARC)? Im using the google maps sdk btw.

Thanks!

Does it cause the app to run out of memory and crash?

Or is it using a ton of memory, receiving a memory warning, and dumping said memory?

So, unless it is causing crashes, it may be behaving correctly.

Apple has extensive and well-documented support for diagnosing these kinds of problems. See "Locating Memory Issues in Your App" .

Check your codes where using NSThreads and GCD blocks. If there are some places you create plenty of threads, it is recommended to add a autoreleasepool block.

Memory may leak in these situation:

  1. If you are writing a program that is not based on a UI framework, such as a command-line tool.
  2. If you write a loop that creates many temporary objects.
  3. If you spawn a secondary thread.

For reference: Using Autorelease Pool Blocks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM