问题
I am developing an Android video player by flutter which is using this lib(0.6.5) for the videos, and this lib uses exoplayer2 underlying.
The player works quite good and smooth for the first few hours (~6 hours), and the videos are ~150-300MB each.
However after ~6 hours of playing, processes start to die, below are some of the log:
Process android.rockchip.update.service (pid 1215) has died
Process com.android.keychain (pid 7666) has died
Process com.android.externalstorage (pid 10029) has died
Process com.android.rk (pid 6798) has died
...
And finally the ActivityManagerService report low on memory and killed the app, after look into the logs, I am suspecting if it is the issue of the lost RAM is higher than usual leads to failure when the video size is larger than the Free RAM:
ActivityManagerService: Free RAM: 320228 kB
ActivityManagerService: Used RAM: 543664 kB
ActivityManagerService: Lost RAM: 1197036 kB
However I am currently having no idea to trace the root cause since there is not much detailed explanation about the Lost RAM on the internet, below attached the related code when loading the videos and disposing them, any advice is welcome
Load:
VideoMediaState._(new VideoPlayerController.file(file));
Dispose:
if ((this._videoController?.isDisposed ?? true)) {
this.widget.finalize();
} else {
if (!this._isDisposing) {
if (this._isDisposable()) {
this._videoController?.dispose();
this._isDisposing = true;
}
}
}
来源:https://stackoverflow.com/questions/52520541/device-activitymanagerservice-report-low-on-memory-after-hours-of-playing-vide