[Closed] garbage collection error
first of all:
#1 how much initial heap allocation memory for max scripts do you have?
#2 do you open bitmaps during the script run?
#3 do you free opened bitmaps before loading new file?
#4 do you reset max file before loading the new one?
Thanks for the reply.
#1 how much initial heap allocation memory for max scripts do you have?
print heapSize
23373864L
#2 do you open bitmaps during the script run?
I’m not sure if bitmaps are being “opened” or not. To fetch the bitmap I’m using:
skinDiff = bitmapTexture filename:(maxFilePath+nnn+"color.tga")
Is that considered “opening” a bitmap? I don’t see a bitmap selection dialog open when the script runs. I think it’s just using the path and filename info I give it to go directly to the file.
#3 do you free opened bitmaps before loading new file?
Again, I’m not sure what is considered “opening” a bitmap, but no I’m not doing anything specifically to free bitmaps. According to the docs, gc does this among other things.
#4 do you reset max file before loading the new one?
I have tried this and I still get the garbage collection error.
#1 you have to add initial memory to be allocated. Go to the preference settings and set maxscript initial heap allocation to ~128 Mbytes
#2 you are opening bitmaps. so…
#3 free old bitmaps before loading new file. use freeSceneBitmaps() for that.
#4 try to do resetMaxFile() and DON’T do any gc()
I had the same error some time ago… I haven’t any bitmap stuff in the scene. It allways happens if i use “reset max”. It was depending on which scene was open.
Solution: startup a fresh max, merge all objects from the problematic scene.
Is this a general tip? I use it on almost all scripts at the end…
reset the max scene does do garbage collection. we are looking for the most stable solution for the batch process. i just don’t want to do gc two times in this case.
Apologies for the necro thread, but I’m still having GC problems and I believe I’ve narrowed the problem down to SME.
Similar threads I’ve found:
http://forums.cgsociety.org/showthread.php?t=929019
http://forums.cgsociety.org/showthread.php?f=98&t=357942
This is the code I have:
fn stripMats =
(
-- Remove material assignments on all objects in the scene
for obj in objects do
(
obj.material = null
)
-- COMPACT MATERIAL EDITOR
matEditor.mode = #basic -- Sets ME to compact mode
actionMan.executeAction 0 "50048" -- Tools: Material Editor
actionMan.executeAction 2 "40293" -- Material Editor: Cycle 3X2, 5X3, 6X4 Sample Slots
actionMan.executeAction 2 "40293" -- Material Editor: Cycle 3X2, 5X3, 6X4 Sample Slots
matEditor.Close()
macros.run "Medit Tools" "clear_medit_slots"
--freeSceneBitmaps() -- Clears all scene bitmaps out of memory
--saveMaxFile (maxFilePath+maxFileName)
-- SLATE MATERIAL EDITOR (SME)
matEditor.mode = #advanced
sme.deleteView 1 false -- Delete current slate in SME
newView = sme.getView(sme.createView "Character Materials") -- Make a new slate in SME
--actionMan.executeAction 0 "40130" -- Redraw all views
--max select none
--freeSceneBitmaps() -- Clears all scene bitmaps out of memory
--saveMaxFile (maxFilePath+maxFileName)
)
I’ve tried running each half of the function alacarte and I’m almost certain it’s the SME stuff that’s causing GC problem. I have set my initial heap allocation to 128MB under Preferences, but that hasn’t helped at all. You can also see that I’ve been commenting out (essentially removing) things as a process of elimination to try to narrow the problem down. Even with the above things commented out I still get GC errors any time I reset the scene or try to open a new scene.
My workstation has 12GB of RAM, so memory shouldn’t be an issue.