Blender Memory Management

Hi! I´m running Blender under Kubuntu 64, and during the last few days I´ve been running across some memory issues with Blender. First, I have to say that I have 8 GB of RAM. I monitored Blender´s behavior in the resources manager, and I found out that after each render Blender is not freeing the memory, not the RAM nor the Virtual Memory. I´m talking about a big 8 GB or so render, so the thing is that the rendering performance progressively decreases as I render more images, as Blender starts to use more and more the swap memory.

I wonder If this is a known issue, or perhaps it is related to my Blender Compilation. I still have to try rendering with the standard version of Blender.

If it is of any good, the most memory consumimg feature I´m using in this render is Hair and Fur.

Well, I´ve tried rendering the same file with a non optimized build, and with the precompiled package from Blender.org, and it´s doing the same thing. So, anyone please render some BBB furry character several times and monitor what happens with the memory. If it happens to someone else I´ll report it as a bug.

hmm, i’m not an expert on these things, but linux also handles memory management a bit differently. even if it might look like śomething is taking lot of memory, or not freeing it, it doesn’t mean the memory is in use. or in a way it is, but if applications or processes need it, linux then frees it.

.b

Yeah, as I’ve noticed, Linux uses almost all of your RAM at all time (once it gets something to put in it that is). As soon as you need this, though, it frees it up. This allows you to quickly reload applications from RAM without having to re-read it from the disk. But I agree that there is really no reason to cache the stuff Blender is working with, as I think it recreates in anyway.

I´ll do some more tests, I´ll try rendering BBB characters and see what happens, maybe there´s something bugged with my own blend files. But anyway, what happens is that I start rendering, and I see that Blender starts using the RAM (it reaches 8GB, and no swap memory is used), and it renders really fast. When the render is finished, the Usage of RAM memory lowers to 6 to 7GB, but before the render the usage was of 1GB…that´s not good…
Well, so then I render the same image again, and I see the RAM growing until it reaches 8GB, and then The swap memory starts to load, when in the first render Blender didn´t use it at all. So, the render gets really slow. I tried using the Free Textures memory option, but it made no difference.

If I close Blender the memory usage lowers to 1GB again… So, for some reason Blender is not freeing the render cache, and this might be a big problem in an animation…

I´ll come back to you when I have ran some more tests.

Thanks

I have noticed this behavior as well. I am trying to render a small animation and I can only render 24 frames at a time. I then need to quit Blender and start it back up to render the next 24 frames and so on.

If I try and render the whole animation 1100 frames then Blender will use up all of my physical memory and all of my Swap and then it will crash.

I have 2Gig of physical and 2Gig of Swap.

Thanks

And when rendering with the commandline? You can make a batch file to render frame by frame, that way blender closes everytime and frees the memory.

Hmm… that sounds like a bug then.

Thanks Jogai, that sounds like a good trick for now. Can you post an example of the command line parameters that you would use in this case??

I’ve rendered the Rabbit file from BBB and the same happened, the first render reached 2.5 GB, the second 3.7GB and the third one was going higher too but I stopped it…

I tried rendering in Woindows at work and it MAY not do this things with the memory…but couldn’t do much testing as it is windows 2000 with 2GB of RAM. I couldn’t even get it to render the Rabbit file.

Well, I posted this at the bug tracker.

I forgot to mention that in windows the second render was a lot faster…

So, a possible conclusion might be that Blender does not free the cache, but it uses it in the next render. At least under windows. It could be possible then, that what is happening to me under linux is not that Blender isn’t freeing the cache, but that Blender isn’t using the previously loaded cache and reloads it over and over…

Egan, if you have Ubuntu and windows, try monitoring this behaviour when you have time.

thanks!

This might also be an Ubuntu Hardy issue…

simmaler problem heare, Ive been backing and re-backing fluid sims pritymuch all day, blender has been slowly eating its way through my 3 gig of ram. Im running 64 bit ubuntu hardy.

You know, I don’t remember having this kind of slow down in Gutsy Gibbon…but I can’t really say that for sure.

I can confirm:
On windows, memory is freed after each render.
On Linux (Ubuntu Hardy Heron), the memory is not freed and remains until you close Blender.

It appears as though it happens in both 2.45 and 2.46 (I didn’t test any other versions).

Thanks Man!!

I don’t have this problem on my Gentoo box.

I’m rendering a animation here in Ubuntu Gutsy and Blender 2.46.

Blender its not eating the memory here, in fact is using less in some frames. But I’m using FSA instead of OSA to…

Anyone from Peach has those problems? I think I read in the blog that they are using Hardy on some machines on Blender institute…

If its not a mistake, this is serious… And I’m looking to update to Hardy! I need to know if its bugging with it! :spin:

Yeah, I hope the guys at the Bug Tracker see my post soon…

any news on this problem??

Im having the same problem in ubuntu hardy.

Well, Brecht told me that the problem could be caused by Memory fragmentation.

Fortunately, I could solve the problem by increasing the size of the SWAP partition. I increased it to 16 GB, the double of my RAM, and things started to work just fine. As Brecht also told me, the memory fragmentation issue disappears after rendering several frames, and that was exactly what happened. I ran some tests, and the first frame took about 5 minutes, the second frame took about 8 and memory usage reached a peak of 8GB of RAM and 8GB of SWAP, but after that, things started to speed up, and finally got stabilized in the fourth frame with a usage of 6Bg of RAM and 6GB of SWAP, and a rendering time of 5 minutes, just as the first frame.

So, I think that the solution to this problem is to give Blender a HUGE Swap partition to use.

note: Well, the 4GB Swap partition that I was using wasn´t enough, so I downloaded a program called SWAPSPACE, that automatically assigns disk space to SWAP. Let me tell you that this is a great tool, but it doesn´t work for Blender, cause even though the program increased my swap space, Blender still hanged up.
I guess that the only solution is to assign a TRUE SWAP partition as I did.

I also installed SABAYON Linux, which I have to admit goes a lot faster than Ubuntu, and the problem was there too, so I don´t think it is a Hardy only issue…

Increase the SWAP Partition!!!