[ios] Release cached tiles on entering background.

Retain current render tiles for fast restart.
Waiting for a memory warning doesn't work because we can't make GL release calls once we're in the background.
This commit is contained in:
Chris Loer
2018-02-13 14:33:07 -08:00
committed by Chris Loer
parent a11b277bc1
commit d4df044ffe

View File

@@ -1158,6 +1158,13 @@ public:
- (void)sleepGL:(__unused NSNotification *)notification
{
MGLAssertIsMainThread();
// Ideally we would wait until we actually received a memory warning but the bulk of the memory
// we have to release is tied up in GL buffers that we can't touch once we're in the background.
// Compromise position: release everything but currently rendering tiles
// A possible improvement would be to store a copy of the GL buffers that we could use to rapidly
// restart, but that we could also discard in response to a memory warning.
_rendererFrontend->reduceMemoryUse();
if ( ! self.dormant)
{