Skip to content

games/NXDoom: memory improvements - #3860

Merged
acassis merged 9 commits into
apache:masterfrom
linguini1:doom-memory-improvements
Oct 18, 2026
Merged

acassis merged 9 commits into
apache:masterfrom
linguini1:doom-memory-improvements

Conversation

@linguini1

Copy link
Copy Markdown
Contributor

Summary

This PR includes several changes to the NXDoom application to improve its dynamic memory usage. It also has some miscellaneous changes to the Kconfig menu organization, and then some nxstyle fixes now that the style checking tool has been updated.

  • Users can pick between z_native and z_zone allocators; previously it was just z_native
  • Users can disable the screen wipe animation which does significant allocation
  • Users can disable the loading icon for disk operations which allocates graphics memory
  • Users can enable memory profiling (good for developers while optimizing)
  • Static rendering target option also applies to the status bar now

NOTE: I also documented the optimization sub-menu in another PR to the docs, and mentioned where to find smaller 'squashware' WAD files since they significantly reduce dynamic allocation.
apache/nuttx#20714

Impact

  • Kconfig menu is more readable
  • Dynamic memory allocation can be further reduced

Testing

Tested using sim:nxdoom to verify that the game was still just as playable as before the changes.

Moves optimization options under the "Optimizations" header for correct
organization.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Allow the user to choose which memory allocation implementation is used
for DOOM.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
The `z_zone` implementation now allows for a static array to back the
memory allocator for devices where heap allocation isn't feasible.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Re-organize Kconfig options into sub-menus for logical separation
between items/better readability in the menu.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Allows disabling the wipe animation which has expensive `z_alloc` calls.
Currently causes the player to be unable to move.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Remove incorrect docstring return statement description left from
copy-paste.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Allow debug options to be enabled/disabled for NXDoom to aid in the
optimization process. Currently adds memory allocator profiling.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Allow user to disable the disk icon on data loading, which saves on
memory allocations.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
@linguini1
linguini1 force-pushed the doom-memory-improvements branch from bc10ca3 to 46c2f23 Compare October 17, 2026 16:28
The status bar can now have its backing render target be statically
allocated if the user has chosen static rendering targets.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
@wwlapaki310

Copy link
Copy Markdown

Tested on a Spresense (cxd56xx, 1.5 MB RAM, ILI9340 used as a frame buffer), with this PR applied and z_native: with CONFIG_GAMES_NXDOOM_NOWIPE=y the game no longer stops at a screen change, and a new game can be started and played. Before, it failed after about a minute with z_malloc: failed on allocation of 64000 bytes.

I had opened #3870 with an option of the same name, so I am closing it in favour of this PR. Related: #3869 (keys from a serial terminal, which I will rebase onto your Kconfig split once this lands) and apache/nuttx#20774 (spresense:nxdoom).

@acassis
acassis merged commit e5af785 into apache:master Oct 18, 2026
41 checks passed
@linguini1
linguini1 deleted the doom-memory-improvements branch October 18, 2026 22:12
@jerpelea

Copy link
Copy Markdown
Contributor

@linguini1 nice optimization

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants