Blender using memory for no reason; Blender loading up Memory Usage. Why is that? So there's actually 2 problems I have regarding Blender's memory usage, which probably aren't much for a regular computer but really slow work for weaker ones and can even cause crashes.


So I have a scene in which there's 4 walls, a towel hanger and a towel with 2 simple materials and 1 million hair particles. When opened, this scene has about 840 MB of memory usage, which makes sense since this number of hair particles needs to use quite some memory to be calculated. Problem is, this amount of memory is present in the viewport when all hair particles are hidden, and anything I do to them won't lower the memory usage. However, when deleting the particle system, the memory usage drops to down 440 MB ,and then when I repeatedly click on a render layer (found this method drops the memory usage to its regular level, I'll explain in the second problem) it drops down to 25 MB. That's a clean-up of 815 MB used for practically nothing. My question is, why is Blender using up all that memory for the hair when it isn't even visible or being used in the viewport? Not to mention, when turning on viewport visibility, while having the display disabled or rendered with a 0% value, it still uses up an extra 300MB of memory.
When visualizing said scene with rendered view and making different changes, the memory usage can rise up from 840MB to 2500MB+. Even when reselecting solid mode and moving to an empty layer, the memory usage stays the same. But when repeatedly clicking on a different layer, the memory usage slowly fades off. Which means when wanting to toggle some materials and visualize them in a scene, for example, I have to continuously deal with time to time lag which obviously slows down the work and quickly gets really annoying. So why is Blender not automatically getting rid of that unused memory usage? Are there any ways I can prevent any of these problems? Thanks.
Basically the problem you're facing is that blender is storing a large amount of memory for the undo steps.

You can change this by going to File -> user preferences, under the Editing tab you'll find a section called Undo.
Here you can adjust the number of undo steps and memory limit.
The lower the amount of undo steps, the less memory blender will have to store.

That's why repeatedly clicking on random operators is clearing your memory stored in previous computationally expensive undo steps.