Large tilesets causes crash on Chrome

It might be that maximumMemoryUsage should be respected in loadTile as well. Now it is only used in unloadTiles, but there might be cases when the “current visible set” of tiles is too large to fit inside the memory limit => so no tiles get unloaded because they are all needed for current frame and still loadTile is loading more and more tiles until crash.

Related commit:

This is something we may do in the future, but it is harder to get right. On new GPUs the default maximumMemoryUsage of 512 MB would actually be pretty low and users would wonder why tiles aren’t loading. Handling it during unload doesn’t have that drawback.

Usually a crash indicates that the tileset is not optimized completely. Sometimes the tree is too deep, texture/geometry memory is too large respective to the tile’s level in the tree, or the geometric errors are not ideal.

The easiest workaround without recreating the tileset is to increase the tileset’s maximumScreenSpaceError.