Memory usage high with AVAssetWriter

Hello. I have been trying to solve a memory issue with AVAssetWriter for two weeks without luck.

The original question I posted to Stack Overflow has some images and maybe more details, but after thinking about it I will try to focus on the update 1 from the post.

This is the code I am running currently: https://gist.github.com/jontelang/8f01b895321d761cbb8cda9d7a5be3bd

So essentially I am creating a video from a lot of .jpg with AVAssetWriter and it balloons up to several hundreds megabytes, 300mb it shows in Xcode and 500mb is shows un Instruments.

The memory is not released until the very end of the processing, and it looks to be internal to the AVAssetWriter (looking at the memory graph in Xcode). Some of the things I see that make up the 500mb is:
  • ConstructPixelFrame

  • InterpolationCacheNew

  • FrameMotionInfo

  • JVTLibComp

So my question, is there a way to control how much of these are needed, to reduce the memory usage.

Thank you
Answered by avasetguy in 669571022
I don't know whether this is a bug or not, it is my first time dealing with AVAsseetWriter.

edit: I accidentally marked this as the correct answer and now I cannot unmark it..
If more memory is being used than you expect, please file a bug report using the feedback assistant.
Accepted Answer
I don't know whether this is a bug or not, it is my first time dealing with AVAsseetWriter.

edit: I accidentally marked this as the correct answer and now I cannot unmark it..
I think you just have to trust your gut. If it doesn't feel like the expected behavior or results, it's worth reporting.
Memory usage high with AVAssetWriter
 
 
Q