I am trying to render this complex scene I am using an hdr and a couple of hair particle systems and when I tried to render the animation it said out of memory so what do I need to do ? Do I get a new bigger ram or a new graphics card . I’ve been using blender for about a year and it was rendering fine but now I am trying both cpu and gpu renders and it won’t work .
Are you rendering it on GPU or CPU? If it's GPU then you
(a) try splitting up and rendering the scene over different render layers
(b) try rendering it on CPU instead. I had to render a complex scene too earlier this month, it kept crashing every time I tried to rendering it on GPU; worked just fine on CPU however it took longer (obviously). If the problem still persists on CPU rendering then you could consider upgrading your RAM; I, myself, have 16GB and that just barely enough for complex renders.
There is not onefactor that determines the amount of nemeory use, but a multitude of them: The amount of vertices/edges/faces, number of subdivisions, particles, texture size and bit depth, complexity of the shaders, volumetrics, simulations, ray bounces, samples, render size, post production effects, etc, etc
As you see the list is long. Optimize as much as you can.