Seeing memory leaks from PHPickerViewController - swift

I've recently integrated the PHPickerViewController per Apple's recommendation for accessing photos within your app. However, testing for memory leaks, I've noticed the picker is producing many memory leaks. I'm running the PHPickerDemo and see the following leaks while profiling:
Image from Instruments Memory Leaks
Any thoughts on how to solve this or is this something we have to wait for Apple to fix?

Related

Analyzer Results vs Leaks by Instruments : iPhone memory leaks

I fixed memory leaks of my application using
X-Code->run with performance tool -> leaks
I submitted my application and later I analyzed my code attaching to device like Build & Analyze for device i got many Potential Leaks popped up when i pressed Product then cmnd+shft+B.
What is the difference between the two, was my fixing of leaks based on instruments wrong?
Is it like some leaks pointed by analyzer may actually cause leaks which are not shown/caught by Performance tool?
When you run the leaks performance tool it will let you know WHEN a leak actually happened. Build & Analyze warns you of potential leaks that COULD happen while your program is running.
Your fixing leaks based on instruments was not wrong, but you should also carefully look into the leaks build & analyze tells you, as they could potentially leak when the program is actually running.

Reading this output from Instruments in Leaks mode?

I'm new to memory management and have been playing around with Instruments in Leaks mode. This is my latest output and I was wondering if I could get some feedback from the SO community. It seems as if my total leak amount is quite high, even though the individual leaks are not that big (I think). Should I be concerned? Should I be looking to get rid of all of these leaks?
N.B. The app runs on the iPhone and doesn't use any network.
The screen you are looking at is not the Leaks. It is the memory allocations of your app.

How does the Instruments stop working automatically?

I try to monitor the allocation through Instruments.
However, when I run to a point, sending some jabber msg, the Instruments stop working automatically.
I wonder how does it stop.
Is there any code in an app could stop the Instruments?
I have faced this problem too. The answer i got was: Instruments does stop if your memory usage is too high. Turn on Allocations, and see the memory usage. In my app, I was calling web services, which were downloading some heavy data, because of which my app's memory consumption would go unto like, 60-70 MB, (for an iPad app). This was causing instruments to crash.
So I had to put some memory fixes. I was able to reduce it to around 12 MB. And then Instruments resumed to work fine. Hope it helps.
It could also be as #Cory Kilger suggests and the app is crashing.
Try running it outside of instruments.
Good luck :)

Memory Allocation in iphone

I am checking memory allocation in performance tool, i am getting more than 90 MB memory allocation while running an app for 30-40 mins.Can anyone tell me at which extent memory allocation can go or there is some specification of APPLE for memory allocation or what is criteria to upload it on an appstore or what .
Please hme next week app is going to upload on an appstore
Manjot Singh
Use Instruments to find memory leaks: in Xcode, chose the menu Run -> Run with Perfomance Tool -> Leaks. See for example this article or this article on how to find and fix memory leaks with Instruments.
I pretty sure that your app has tons of leaks, if you are saying that memory usage grows during time. This could be the reason why appstore can reject your app, so you'd better fix that.

iOS Development: What are some ways I can troubleshoot a lag issue in my game that occurs 15 - 30 minutes after playing it?

I'm building an iOS puzzle game to become familiar with the platform and a few of my testers are noticing a severe lag issue that occurs intermittently about 15 to 30 minutes after playing it and the lag doesn't appear to be associated with any specific part of the game. I've tested the app using the Leaks instrument and havent found any leaks yet.
What are some things that would cause a game to instantly begin to lag after playing it for a while?
What are some methods/tools I could use to troubleshoot the lag?
Thanks so much for your wisdom!
UPDATE: As a new iOS developer, I was under the impression that the Leaks instrument would report at least most of my memory leaks, so I was very comfortable believing my app was managing memory properly when no leaks were reported. Not the case! After following a few of the suggestions posted here, I watched a few videos on how to use the Allocations instrument and found that my app was losing a TON of memory over time and, after spending about two hours walking through ALL my code and fixing memory-related code, my game is no longer lagging or reporting any lost memory or memory leaks. Thanks, all!
The main thing would probably be a memory warning, which would in turn cause a bunch of game assets possibly to be freed all at once...
Instead of leaks, the place to start is the ObjectAlloc tool. Leaks only shows you memory used your application already knows about. ObjectAlloc shows you the total memory used, and the real issue would be seeing the graph of memory used climb over time.
Lastly, I would try to get the game into that state while using the TimeProfiler instrument, so that you could see what kinds of operations took up a lot of time suddenly when the game slowed down. You have to do that on device, it will not tell you what is really going on using the simulator.
check to see if you are getting a memory warning. also, try using the heap shot tool in instruments, as something could be holding on to a reference, and stopping objects from deallocating, this doesnt show up as a standard leak.
i would definitely have a look at the object allocation tool, and keep an eye on objects still living.
if you haven't used instruments much, I think apple have some videos up on the dev site going through them.
Are you using leaks with the simulator or with an actual phone? I have found the simulator to have different results than a phone when running leaks. Based on your description it sounds like you have some leaks occurring.
I have had some similar feedbacks while battery runs low. So, you can check, does issue reproduce when device is powered, or not.
Also, do you use openGL in your game? I'm asking because i've observed some lags with first-time appeared textures drawing, although these textures were previously preloaded and cached.
And last question, what devices your testers are working with?
LEAKS are NOT the same as excessive memory allocation.
It sounds like you are just not releasing things that don't need to be around anymore and you're maxing out on memory and chunking.
Check your allocations and keep an eye on what keeps expanding when it shouldn't.