I am getting the same error in a normal UE5.4 project.
I watched the memory usage use all physical memory and more than double that in page file before getting the error. All up it was using 169GB of memory.
So I don’t think upgrading to 32GB will fix it necessarily.
Strangely the project was running fine until I loaded it up one day and it did this error every time i compile my characters.