[Closed] Flushing memory between renders
I have a fairly complex scene that’s giving me a headache. The problem is that I have barely enough memory to render it, and can do a single render just fine after I load the scene, but usually before second or third render, it gives me error message and closes. It’s making test renders quite awkward.
Now, there’s gc() function for scripts, but is there any way to recover ram from other processes.
This is for max2008 and Mental Ray.
If mental ray isn’t releasing the memory it’s using after renders, and allocating new memory each render, then it’s a horrible memory leak in MR that you’re experiencing.
There shouldn’t need to be a function to release mental ray’s memory. It’s supposed to clean up after itself, like any well-behaved plugin.
Yeah, I figured as much and agree.
I tested it a bit further and now it seems it crashes similarly even if I have prenty of free ram. I tried optimizing the memory with external program and it did the trick nicely (also fun to see how much unneeded trash gets loaded on scene startup), but it didn’t affect performance that much. Probably a bug.
Might be material or map related, since I can render plain geometry up to the point where it starts paging and never run into problems. Backburner doesn’t seem to have this problem either, even with 2 instances of max and the scene open at once.
This might release a bit of memory:
freeSceneBitmaps(); gc()
And if you don’t want to lose your undo history, use:
freeSceneBitmaps(); gc light:true
Martijn
My name is only occasionally martijn, but… freeSceneBitmaps() does not free up any bitmap memory allocated by maxscript. so even if you have a ‘myBmp’ that holds a bitmap, then set ‘myBmp = undefined’, freeSceneBitmaps() doesn’t clear the memory – only gc() / gc light:true do.
fn maxMemUse = (sysinfo.getMAXMemoryInfo())[3] / 1024.0 / 1000.0
maxMemUse()
90.896
myBmp = openBitmap "c:\\fotos\\2007Dec26\ hehague_central_station.jpg"
BitMap:c:\fotos\2007Dec26 hehague_central_station.jpg
maxMemUse()
198.94
freeSceneBitmaps()
OK
maxMemUse()
198.948
myBmp = undefined
undefined
maxMemUse()
198.948
gc light:true
65811048L
maxMemUse()
91.168
Hi Haamu,
A long shot but are you storing a final gather solution? One time recently i had a file that exhibited the same characteristics and solved it by deleting the save FG file and rebuilding.
FreeSceneBitmaps() seems to do the trick nicely. Haven’t had a single crash when I pop that before renders.
Thanks for all suggestions.