johnboiles / coremediaio-dal-minimal-example

Intended to be the most minimalistic example of a macOS CoreMediaIO DAL plugin.
MIT License
212 stars 31 forks source link

Memory consumption in plugin affects App consuming stream #6

Closed gerwindehaan closed 4 years ago

gerwindehaan commented 4 years ago

I am experimenting with consuming the virtual stream from my own MacOS app, and notice the memory consumption grows alarmingly quickly when active. Within a minute you'd reach ~2GB. After disabling my own changes (swift bridge to draw an animated shape to "prove" this is live), I still got it, and likewise in other apps. E.g. this can be reproduced by viewing the stream through QuickTime Player and observing that Apps' memory consumption. When I have time I can dig in a bit myself, although my Obj-c is virtually non-existent.

gerwindehaan commented 4 years ago

Core Graphics is often not auto-releasing (e.g CGContext), so I would look for strategic single-usage of the CGContext etc, or resort to placement of sections into @autoreleasepool

johnboiles commented 4 years ago

I noticed that also yesterday! Yah I'm sure I have a core graphics memory management bug in there. You're probably right that it's something about my drawing code.

johnboiles commented 4 years ago

I think I fixed in https://github.com/johnboiles/coremediaio-dal-minimal-example/commit/f416ff014e98e74afb53be7640e9ff46307dbf3b

I'm testing on my end and so far so good, but if you had a moment i'd love a double check.

jrappeneker commented 4 years ago

I can confirm it has worked for me!

gerwindehaan commented 4 years ago

Yes, fix confirmed!

johnboiles commented 4 years ago

Woohoo!