When a PagedSplats instance is disposed, the SplatPager has no awareness of the disposal, leading to two problems:
1. In-flight downloads are not cancelled
Fetch operations started by driveFetchers() use no AbortController, so they run to completion even after the PagedSplats they were loading for has been disposed. This wastes bandwidth and CPU decoding data that will never be rendered.
2. Memory leak in pager maps
After the orphaned fetches complete, processFetched() inserts the disposed PagedSplats into splatsChunkToPage and pageToSplatsChunk with no disposal check. Those references keep the object alive until the pages happen to be LRU-evicted. If datasets are added and removed frequently, dead PagedSplats objects accumulate.
Root cause
PagedSplats.dispose() only frees its own texture (dynoIndices). It does not notify the pager, cancel pending fetches, or trigger page eviction.
Suggested fix
- Pass an
AbortController signal into fetch calls, abort it in PagedSplats.dispose()
- Have
PagedSplats.dispose() notify the pager to evict all pages belonging to that instance
When a
PagedSplatsinstance is disposed, theSplatPagerhas no awareness of the disposal, leading to two problems:1. In-flight downloads are not cancelled
Fetch operations started by
driveFetchers()use noAbortController, so they run to completion even after thePagedSplatsthey were loading for has been disposed. This wastes bandwidth and CPU decoding data that will never be rendered.2. Memory leak in pager maps
After the orphaned fetches complete,
processFetched()inserts the disposedPagedSplatsintosplatsChunkToPageandpageToSplatsChunkwith no disposal check. Those references keep the object alive until the pages happen to be LRU-evicted. If datasets are added and removed frequently, deadPagedSplatsobjects accumulate.Root cause
PagedSplats.dispose()only frees its own texture (dynoIndices). It does not notify the pager, cancel pending fetches, or trigger page eviction.Suggested fix
AbortControllersignal into fetch calls, abort it inPagedSplats.dispose()PagedSplats.dispose()notify the pager to evict all pages belonging to that instance