Skip to content

wpad: use malloc instead of lwp_wkspace alloc, check for OOM error#266

Open
Zarithya wants to merge 2 commits into
devkitPro:masterfrom
Zarithya:wpad-oom-fix
Open

wpad: use malloc instead of lwp_wkspace alloc, check for OOM error#266
Zarithya wants to merge 2 commits into
devkitPro:masterfrom
Zarithya:wpad-oom-fix

Conversation

@Zarithya

@Zarithya Zarithya commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

When the lwp_wkspace was shrunk from 1MB to 64KB, Wiimotes stopped being able to be allocated, as they needed >100KB just to allocate the command queue! Previously, this error was occurring silently, meaning the first two Wiimotes would sync properly but the third was a toss-up and the fourth (and Balance Board) straight up crashed. This PR adds a check to ensure Wiimote init code bails out if out of memory, as well as moving non-essential allocations to use normal malloc instead of lwp_wkspace_alloc.

@DacoTaco

DacoTaco commented Jun 7, 2026

Copy link
Copy Markdown
Member

lgtm, any opinion @fincs ?

@fincs

fincs commented Jun 7, 2026

Copy link
Copy Markdown
Member

Lgtm. If only, it would be nice to fix this code to deallocate the memory on deinit.

@Zarithya Zarithya marked this pull request as draft June 7, 2026 22:39
@Zarithya Zarithya marked this pull request as ready for review June 7, 2026 22:47
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.

3 participants