Hi Guys! I just read about garbage collection and it seems "OK" that maxscript reserves more and more memory with every script-run. BUT i wondered why this small scripts counts the rollout numbers up and up...
Script:
(
rci = rolloutCreator thename "test title"
rci.begin()
rci.end();
print rci.def
)
Ouput after 1st run:
Rollout:rolloutCreator1
Output after 2nd run:
Rollout:rolloutCreator[B][COLOR="DarkOrange"]2[/COLOR][/B]
...these rollouts are created in a local scope and so i would expect that after the script is done, max doesn't know that the rollout ever existed. But it does. Yes the first argument is a variable which doesn't exist, but anyway, i wonder why the script output counts up and up. I hope this isn't some kind of memory leak where every rollout stays in memory until a max restart. Even a gc() doesn't "reset" the numbers which the rollouts get.
Replies
Ive never used the rolloutcreator struct before. I usually use "createDialog" and "destroyDialog" and assign my rollout to a global variable so I can test to see if its already open and then destroy it so I don't create a second window when the script is ran again.
Like this:
Yeah i was just afraid that maybe it creates several instances under the same name when using a string. Thanks for your examples! I normally do it like you said but this time i need a dynamically created UI which makes me use the rolloutCreature function.
Swordslayer
That's weird. Because when i try to access "rci" i just get "undefined" back. Only when i delete the ( and ) and make the whole script to global scope, i can access "rci" after i executed the script.
The output holds pretty steady for me.
Ah ok now it's more clear to me, thank you for your answer!
monster
Oh cool thank you! Didn't know that!