Skip to content

Reduce memory usage substantially - #6901

Open
metalgearsloth wants to merge 2 commits into
space-wizards:masterfrom
metalgearsloth:2026-08-03-memory
Open

Reduce memory usage substantially#6901
metalgearsloth wants to merge 2 commits into
space-wizards:masterfrom
metalgearsloth:2026-08-03-memory

Conversation

@metalgearsloth

Copy link
Copy Markdown
Contributor
  • Remove unnecessary mappings after resolving prototypes. The downside is we make TryGetMapping much slower (which is used rarely and on slowpaths) but we also significantly reduce memory usage.
  • Shallow copy parent nodes and pretend prototype datanodes are readonly until we get a better read-only API (because they really, really should be). If a child changes 1 component it shouldn't deep-copy 1 morbillion nodes.
  • Remove 2 ints per datanode for 99.99% of them and use a scrunkly table for the remainders.
  • Use array for sequencedatanode storage where we can get away with it otherwise fall back to list.

Client uses 400MB atm
image

Down to 290MB
image

Unfortunately the actual non-headless client uses a significant amount of memory for textures + audio (for obvious reasons) but for headless client this helps a lot.

- Remove unnecessary mappings after resolving prototypes. The downside is we make TryGetMapping much slower (which is used rarely  and on slowpaths) but we also significantly reduce memory usage.
- Shallow copy parent nodes and pretend prototype datanodes are readonly until we get a better read-only API. If a child changes 1 component it shouldn't deep-copy 1 morbillion nodes.
- Remove 2 ints per datanode for 99.99% of them and use a scrunkly table for the remainders.
- Use array for sequencedatanode storage where we can get away with it otherwise fall back to list.
@deltanedas

Copy link
Copy Markdown
Contributor

are xaml proxies even needed for headless it sounds like that can be skipped

@metalgearsloth

Copy link
Copy Markdown
Contributor Author

Ideally you'd run headless clients on release where (hopefully) xamlxproxymanager shouldn't be running, but that should also be disabled on debug or have a CVar for it yeah.

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.

2 participants