磁贴池调整大小Tile pool resizing

如果应用程序需要更多工作集以容纳流式资源映射,可以扩大磁贴池,如果需要更少空间,可以缩小磁贴池。Resize a tile pool to grow a tile pool if the application needs more working set for the streaming resources mapping into it, or to shrink if less space is needed. 另外,应用程序还可以分配额外的磁贴池用于新的流式资源。Another option for applications is to allocate additional tile pools for new streaming resources. 但是,如果任何单一流式资源需要的空间超出其磁贴池中原本可用的空间,扩大磁贴池则是一个不错的选择。But if any single streaming resource needs more space than initially available in its tile pool, growing the tile pool is a good option. 流式资源无法同时映射到多个磁贴池中。A streaming resource can't have mappings into multiple tile pools at the same time.

磁贴池扩大后,显示驱动程序将通过一个或多个新分配空间将额外的磁贴添加到末端。When a tile pool is grown, additional tiles are added to the end via one or more new allocations by the display driver. 各个分配空间的细分内容对应用程序不可见。This breakdown into allocations isn't visible to the application. 磁贴池的现有内存保持不变,进入内存的现有流式资源映射保持不变。Existing memory in the tile pool is left untouched, and existing streaming resource mappings into that memory remain intact.

缩小磁贴池时,将从末端移除磁贴。When a tile pool is shrunk, tiles are removed from the end. 磁贴被移除后,空间可能会小于最初的分配空间大小,最小降至 0,这意味着新映射无法通过新大小的空间。Tiles are removed even below the initial allocation size, down to 0, which means new mappings can't be made past the new size. 但是,通过新大小的空间的现有映射将保持不变并且可供使用。But, existing mappings past the end of the new size remain intact and useable. 只要指向驱动程序用于磁贴池内存的任何部分分配空间的映射保留,显示驱动程序将保留内存。The display driver will keep the memory around as long as mappings to any part of the allocations that the driver uses for the tile pool memory remains. 如果缩小后,部分内存因有对应的磁贴映射而一直保持活动状态,随后再次扩大(任何容量的)磁贴池时,将在进行任何额外分配之前先重用现有内存以提供扩大操作所需的空间大小。If after shrinking some memory has been kept alive because tile mappings are pointing to it and then the tile pool is regrown again (by any amount), the existing memory is reused first before any additional allocations occur to service the size of the grow operation.

为了能够保存内存,应用程序不仅需要缩小磁贴池,还需要移除/重映射通过新的较小磁贴池末端的现有映射。To be able to save memory, an application has to not only shrink a tile pool but also remove/remap existing mappings past the end of the new smaller tile pool size.

缩小(和移除映射)操作不一定能立即节约内存。The act of shrinking (and removing mappings) doesn't necessarily produce immediate memory savings. 内存释放取决于显示驱动程序用于磁贴池的基础分配空间的粒度。Freeing of memory depends on how granular the display driver's underlying allocations for the tile pool are. 如果缩小后恰好能空出显示驱动程序分配空间,则显示驱动程序可释放此空间。When shrinking happens to be enough to make a display driver allocation unused, the display driver can free it. 如果磁贴池曾被扩大,则缩小至原有大小(并相应移除/重映射磁贴映射)最有可能实现内存节约,但在大小与显示驱动程序选择的基础分配空间大小不完全一致的情况下无法保证。If a tile pool was grown, shrinking to previous sizes (and removing/remapping tile mappings correspondingly) is most likely to yield memory savings, though not guaranteed in the case that the sizes don't exactly align with the underlying allocation sizes chosen by the display driver.

相关主题Related topics

到磁贴池中的映射Mappings are into a tile pool