The rendering process stops and the following error message appears:
CUDA error: unable to allocate enough memory to perform the requested operation (out-of-mem)
[GPU Light Cache ]could not allocate buffer of size
Could not allocate texture buffer on device
Why it happens?
This error message indicates that a project is too complex to be cached in the GPU's memory. Each project contains a certain amount of data that must be uploaded either to the RAM (when the CPU engine is chosen) or to the VRAM (the GPU's memory, when the GPU engine is CUDA or RTX).
GPUs tend to have a much more limited amount of memory compared to the amount of RAM a computer has. Sometimes a project can be too large and fail to be fully uploaded to the VRAM. Some factors that play a role are the complexity of the geometry, heavy use of high-resolution textures, the render settings and more.
1. Optimize project to use less memory. In the linked article you can find suggestions and workflows that will help you optimize the scene.
2. Upgrade your GPU device to one with a larger GPU memory.
3. Use the GPU device with the largest amount of memory available. If more than one GPU device is available on the machine, render the scene only with the device that has the largest GPU memory available.