Skip to content

Improve Scene Loading when client is close to running out of memory#993

Open
RuffledPlume wants to merge 1 commit into117HD:masterfrom
RuffledPlume:ReuseSceneContextData
Open

Improve Scene Loading when client is close to running out of memory#993
RuffledPlume wants to merge 1 commit into117HD:masterfrom
RuffledPlume:ReuseSceneContextData

Conversation

@RuffledPlume
Copy link
Contributor

@RuffledPlume RuffledPlume commented Mar 8, 2026

Time bounded GC added before loading next scene:

21:00:01.903 [Map Loader] DEBUG rs117.hd.utils.HDUtils         - Memory Stats: heapUsage=90.4%, used=463MB, free=48MB, total=512MB, max=512MB, expandable=0MB, littleExpandable=true, lowFreeInHeap=true
21:00:02.032 [Map Loader] DEBUG rs117.hd.utils.HDUtils         - GC reclaimed 110MB of memory (After 1 iterations, 129ms elapsed)

@RuffledPlume RuffledPlume force-pushed the ReuseSceneContextData branch 6 times, most recently from fe07192 to e0c8b0d Compare March 11, 2026 21:16
@RuffledPlume RuffledPlume changed the title Reuse Previous SceneContext Data Improve Scene Loading when client is close to running out of memory Mar 12, 2026
@RuffledPlume
Copy link
Contributor Author

PR has been improved, ontop of reusing the SceneContext to avoid allocating 16 MBs during scene Load. It now tracks the memory state over the last 64 frames to determine if we're consistently running close to the max memory, if we're in this state then scene loading is forced to be sync load instead of going wide across job system workers.

@RuffledPlume RuffledPlume force-pushed the ReuseSceneContextData branch 11 times, most recently from 3432e03 to 86fa93e Compare March 13, 2026 16:17
 * Reuse Previous SceneContext Data
 * Added GC Hint to try to catch when a OOM is impending
 * Moved Model Pushing Arrays into LegacySceneContext Class
 * Print Memory stats before & after hinting GC
 * Track Memory State across the last 64 frames
 * This allows us to determine if we're consistently running close to the edge of the max memory
 * Override Expanded Chunk Loading if we're running low on memory, effectively forcing lowMemory mode
@RuffledPlume RuffledPlume force-pushed the ReuseSceneContextData branch from 86fa93e to b85e1c7 Compare March 13, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant