NewChromantics / PopH264

Low-level, minimal H264 decoder & encoder library for windows, hololens/uwp, ios/tvos/macos, linux, android/quest/magic leap. CAPI for use with c#, unreal, swift
http://poph264.com/
Mozilla Public License 2.0
84 stars 15 forks source link

Memory leak on Windows #37

Closed nick-cr closed 3 years ago

nick-cr commented 3 years ago

Steps to reproduce:

Either

  1. On Windows create an instance of the decoder
  2. Decode some frames
  3. Get rid of the decoder with Dispose() or PopH264_DestroyDecoder(Instance.Value);
  4. Repeat a few times

or

  1. Add Mp4 to a scene with some content
  2. Start the scene in the editor, wait for frames
  3. Stop the scene in the editor
  4. Repeat a few times

The memory is not cleared (which looks roughly equivalent to the buffered frames). If you create instances of players regularly and play relatively high definition video this is a very quick memory leak!

SoylentGraham commented 3 years ago

Most being freed now, a decoder can decode 10,000 frames and use the same amount of memory, but when the transformer/decoder is released, some memory still lingers around. (Broadway doesn't do this, so it's definitely something inside mediafoundation)

SoylentGraham commented 3 years ago

Fixed in 5770d4a7e9a4a0afddbec919235b6f892c2a806c