[Windows] Excessive memory consumption when video playback with AIR 33.1.1.345
Problem Description
Excessive memory consumption when video playback with AIR 33.1.1.345 by Windows devices.
It has been tested with latest AIR 33.1.1.345 with many different Windows devices. Simple AIR 33.1.1.345 application (sample attached below) that playback MP4 H.264 1920*1080 (FullHD) video consumes ~160 MB RAM according Windows Task Manager. But with AIR 32.0.0.89 it consumes only ~60-100 MB RAM. Same problem in all cases with any videos. Notice that every next loop of video cause another bug with memory leak: https://github.com/Gamua/Adobe-Runtime-Support/issues/572
It works fine with AIR 32.0.0.89 and below.
Related issues (not the same): https://github.com/Gamua/Adobe-Runtime-Support/issues/572 https://github.com/Gamua/Adobe-Runtime-Support/issues/587
Steps to Reproduce
Launch code below with Windows devices and look at Windows Task Manager memory consumption by AIR application.
Application example with sources and example of video attached. video_excessive_memory_consumption_bug.zip
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.media.Video;
import flash.events.NetStatusEvent;
public class VideoExcessiveMemoryConsumptionBug extends Sprite {
private var nc:NetConnection;
private var ns:NetStream;
private var video:Video = new Video(640, 480);
public function VideoExcessiveMemoryConsumptionBug() {
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
addChild(video);
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, ncHandler);
nc.connect(null);
}
private function ncHandler(e:NetStatusEvent):void {
if (e.info.code == "NetConnection.Connect.Success"){
ns = new NetStream(nc);
ns.client = {onMetaData:getMeta};
ns.addEventListener(NetStatusEvent.NET_STATUS, nsHandler);
video.attachNetStream(ns);
ns.play("video.mp4");
}
}
private function nsHandler(e:NetStatusEvent):void {
trace(e.info.code);
if (e.info.code == "NetStream.Play.Stop"){
ns.play("video.mp4");
}
}
private function getMeta(mdata:Object):void { }
}
}
Actual Result: AIR application consumes ~160 MB RAM.
Expected Result: Application correctly exit without crashes. AIR application should consume ~60-100 MB RAM like before with AIR 32.0.0.89.
Known Workarounds
none
With latest AIR 33.1.1.476 RAM consumption varies between ~100-160 MB in run-time in different video playback moments. Better than with AIR 33.1.1.345 but much more higher than AIR 32.0.0.89.
I'm seeing gradual memory leak while playing 7 video thumbnails on a menu screen. With nothing else happening, not interaction, just looping videos, it eventually runs out of memory. AIR 33.1.1.476 running on Windows 10 computer. Watching the memory just go up gradually, like it's not clearing out the video cache. The videos are small and looping, so there isn't a reason to be allocating memory. Videos are mp4s generated by my client and linked in dynamically at runtime.
@AndrewKeplinger is there any chance you could provide a test case for this? thanks
Issue still exists with latest AIR 50.0.0.1. And with 4K-8K videos playback RAM consumption enormous. With non-AIR video players for such high resolution videos playback memory consumption 2-3 times lower.