S
S
svatorus2017-06-01 17:39:46
iOS
svatorus, 2017-06-01 17:39:46

UIImage vs Memory, who wins?

There is an application that works with photos from the library through the Photos framework - select from the library -> crop-> send to the server.
On the iPhone SE, 5S, 5C, 4s, everything works fine, the use of RAM memory, God forbid, reaches 50 mb, in general, OOM on these devices is just fairy tales and a nightmare.
But when we run the app on the iPhone 6 and newer phones, the memory is consumed at an incredible pace - there are jumps up to 400 mb. In particular, there is a scrolling table with cells containing a UIImageView with photos in good quality in Instruments, some kind of hell happens.
One gets the feeling that in order to display a photo in UIImageView, the size of 3 mb, the system needs all 30.
So I can’t understand - am I a krivoruk or is there something wrong with ARC (or something else?) On a certain group of devices? 6 feeling suggests that Retina3x can somehow participate here, but these are just guesses.
Has anyone come across? Managed to overcome?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Cherny, 2017-06-03
@freeg0r

Pay attention to the blocks in the code (completion handlers), maybe you have a capture somewhere and the block holds the object, and the object holds the block, for this Swift has unowned and weak reference types. Using reusable objects exacerbates the problem. Use Instruments for debugging.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question