I am trying to render a scene, but I constantly get the same error message: 'CUDA error: Out of memory in cuMemAlloc'. The scene is 3480 by 5304px. I'm rendering with my GPU on a 64 bit operating system with 16GB RAM. I have an NVIDIA Geforce GTX 1060 videocard and there should be plenty of storage space left, as I've only recently bought my computer. I've tried decreasing the samples from 20 000 all the way down to 250, but without avail. If anyone were to know how to solve the issue, please share your knowledge here :)
This is normal. Your specific graphics card may have 3 or 6 GB of VRAM depending on the model. Your 3d scene needs to be loaded to the memory of your graphics card for it to be rendered on the GPU. It will eventually run out of memory as your scenes get bigger same way as you run out of hard disk space eventually as you have too many files on your computer.
To solve the issue, you can render your scene on CPU so your 16GB of RAM are used instead of the 3 or 6 GB of VRAM in your GPU.
Another way could be making sure that you are not using unnecessarily too much of geometry or particles and the textures you use are not bigger than you need. You should keep in mind that the textures used on GPU are not compressed, so it does not matter if you are using small compressed .jpg files - they will be uncompressed to their full size during rendering.
Of course another solution would be to upgrade the graphics card to one with more memory. That would work as well. GTX 1080TI cards for example have 11 GB of memory. However, it is not difficult at all to run out of that as well if you use particles for example. You should always keep resources in mind when designing your scenes.