I am using AVURLAsset together with AVAssetReader and my own custom resourceLoader in order to read an mp4 video frame by frame, from an NSData* of the mp4.
It all wroks fine, and after putting autoreleasepool almost everywhere, the memory also doesn't inflate over time.\
However, memory consumption is massive.
I see this memory consumption on Other process, so I cannot even properly track it.
I know this memory is from the AVURLAsset or even AVAssetReader, because it change as I open new mp4 files this way.
The mp4 files I open only contain 300 frames of 2048x2048 RGBA pixels.
Each such file weigh less than 30MB, but each file i open with AVAssetReader takes hundreds of MBs in other processes memory.
What is worse, when I read the file from begining and need to recreate AVAssetReader, I get a memory spike, as if the memory of hte previous AVAssetReader isn't able to release before the new AVAssetReader memory is consumed.
autoreleasepool didn't help preventing this spike.
I don't understand how a 30MB mp4 file can have such a massive memory footprint in iOS.
Perhaps I should try to use a YUV frames to read instead of BGRA32, because maybe it have massive cahces in order to convert YUV to BGRA?
This is really weird.
Any help reducing the memory footprint is appreaciated.
I am using ObjectiveC by the way,