0

When cobalt run into background mode by suspend, it will still cost about 80M memory(about 130M memory at foreground), it used too much memory in background mode, so where does it cost so much memory in background mode, in which part does it cost? Is there a plan to improve it?

bitchainer
  • 535
  • 2
  • 19
  • Can you define what "too much" memory is? What are your expectations? – David Ghandehari Mar 24 '17 at 03:48
  • hi, david, I mean 80M is high for cobalt to run in background, from our experience with other apps on the platform, it's about 30M-40M in background(eg. when it run into background mode, it freeed all the memory of UI). – bitchainer Mar 24 '17 at 04:20

1 Answers1

0

When Cobalt goes into Suspended mode, it releases all GPU resources - image caches, swap chain, etc. It also shuts down the SbPlayer, freeing those resources.

All Javascript, DOM, and CSS memory is retained, so the HTML5 application does not need to be reloaded when Resumed.

Perhaps unexpectedly, the MediaSource buffers are also retained. This is so that it can resume playback immediately on resume. This is mainly because the application isn't notified that it is being suspended, so Cobalt has to secretly restore the media element state on Resume.

The media source buffers can be a lot of memory, around 24 megs at 1080p, and 60-80 for 4k.

David Ghandehari
  • 534
  • 3
  • 12
  • hi, david, I also observed that the Youtube UI is not closed in background, so this part of memory is still been used, is it? Besides, Is there plan to improve the memory usage of cobalt in background? – bitchainer Mar 24 '17 at 08:54
  • I'm not exactly sure what you mean by "UI" in this case. All Javascript state must be retained, or the HTML5 application must be completely reloaded, which would mostly defeat the purpose of staying in the background. – David Ghandehari Mar 25 '17 at 07:59
  • Regarding plans: The Cobalt team is always looking for ways to reduce memory, both in Suspended mode and during normal operation. There are currently no specific targets that Cobalt is attempting to hit. – David Ghandehari Mar 25 '17 at 08:06
  • the Youtube UI in this case I mean is the youtube home page, when it enters supsend mode, it will only hide the home page, and when it resumes cobalt, the UI will show immediately even the network is discnnected, so it seemed the memory which stored the Youtube Home page is still been used(not freed), and not reload the youtube URL actually. Maybe as you said, the UI memory is keeped for speeding up rendering the youtube page. – bitchainer Mar 27 '17 at 00:30