Skip to content

SplatPager leaks memory and wastes bandwidth when a PagedSplats is disposed #318

@onderilkesever

Description

@onderilkesever

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions