maplibre / maplibre-native

MapLibre Native - Interactive vector tile maps for iOS, Android and other platforms.
https://maplibre.org
BSD 2-Clause "Simplified" License
1.03k stars 300 forks source link

Fixed memory usage high in some cases #2442

Closed alexcristici closed 4 months ago

alexcristici commented 4 months ago

Fixed metal rendering when presentsWithTransaction is enabled, based on Apple documentation: Setting this value to YES makes the layer draw its contents synchronously, using whichever Core Animation transaction is current at the time you call the drawable’s present method. To ensure that a transaction is available when you schedule the drawable to be presented, first commit the command buffer containing your Metal rendering commands. Then, call its waitUntilScheduled method to synchronously wait until the command queue schedules the command buffer to execute on the GPU. Finally, call the drawable’s present method. Source: https://developer.apple.com/documentation/quartzcore/cametallayer/1478157-presentswithtransaction?language=objc.

This will fix correctly also the following issues: https://github.com/maplibre/maplibre-native/issues/2337, https://github.com/maplibre/maplibre-native/issues/2380, https://github.com/maplibre/maplibre-native/issues/2053, so I removed old hacks.

Allocations after the fix:

https://github.com/maplibre/maplibre-native/assets/19795769/8722d529-d974-49e8-aaa4-748a54b25e60

github-actions[bot] commented 4 months ago

Bloaty Results (iOS) 🐋

Compared to main

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  -0.0%    -416  [ = ]       0    TOTAL

Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results-ios/pr-2442-compared-to-main.txt

louwers commented 4 months ago

Nice! I can make a release when this is merged.