Hi there!
I'm my case, Xcode 13.3 was breaking with the "LLVM ERROR: out of memory" when archiving. Reading the error log, I've found something interesting: "Embedding bitcode". Well ... bitcode generation is optional. So I've disabled bitcode for that target: Build Settings -> Enable Bitcode = No.
And that's it! After turning off bitcode, Xcode 13.3 was able to archive with no more "LLVM ERROR: out of memory".
So search for "Embedding bitcode" in your Xcode's error log. If you find it, this is the cure ;-). If not, sorry, can't help you.