Could debug/develop builds just use more memory than release.
I have this also on android builds, on M1/8GB mac. (First time I think I should have waited for the 16GB model. Though my Unity editor crashes with 49GB memory usage once in a while so the apple silicon editor has it’s problems…) It fails instantly when “memory pressure” goes yellow (memory is full?).
Workaround for me is to close all other big memory using programs like vscode, firefox etc. But I think it’s a bug/issue anyway, you should be able to build with a lower spec machine, just take longer. And I have a relatively small project, if your project is big your memory use is probably also bigger.