High resolution panoramic images (with multiple cameras and view layers)


I would like to ask for advice rendering an apartment. I have cameras in each room, all room is arranged into separate view layers. These cameras are also set up as panorama cameras. I would like to render each room into a high resolution panoramic image and apply compositing on each image too.

I think I managed to figure out the compositing. I created a render layer node for each view layer and directed them into their own final composite node. So far this part is working.

The bigger question is how to achieve higher resolution renders? I can do around 2000x1000 but as soon as I go around 4000x2000 blender just crashes. I have 32GB ram and 11GB video memory but obviously it is not enough.

I have read about python scripts which can do this but could not find them.

Anyone can point me to a script or addon for this purpose? (I am using Blender 2.93.4)