Community
SCI Programming => SCI Syntax Help => Topic started by: gumby on February 15, 2011, 02:14:53 PM
-
Is there any difference between these two commands in this context?
UnLoad(rsSCRIPT 100)
DisposeScript(100)
According to the Studio help file:
UnLoad - Unloads a resource from memory. If the resource is rsMEMORY, it frees the allocated memory specified by it's pointer.
DisposeLoad - Unloads a script from memory, including all it's classes, instances, variables, etc.
Just curious.
-
Somewhere if you track down the dispose script, it makes an unload call, Skip the middle man I say. i unload the resources i use in each script. i don't trust enough i guess
-
I wasn't able to find a 'Dispose' script. Might you be thinking of the 'DisposeLoad' script? Here is the procedure:
(procedure public (DisposeLoad rsType rsNumbers)
(var i, num)
= paramTotal (- paramTotal 2)
(for (= i 0) (<= i paramTotal) (++i)
= num rsNumbers[i]
(if(rsType)
Load(rsType num)
)(else
DisposeScript(num)
)
)
)
As a side note, I don't quite understand why we would be calling the Load() function (sometimes) if we are calling a script which I would think would be 'unloading'. I see that in the Main.sc we call this procedure with a NULL value for rsType, so the Load() in this case never gets called...
-
Yeah I'm pretty sure there is a template bug fix post, maybe somewhere else, mines had an unload there for years, forgot it said load... and yeah thats the script I was talking about.
* apparantly that was way back in the Mega-Tokyo days... not seeing it anywhere now.
-
So why the difference in the releasing of resources (Unload vs. DisposeScript)? That would seem to suggest that you 'Unload' some resources, like pics & texts. But when it comes to a script, one should unload via DisposeScript? Perhaps to ensure all the variables, etc. get removed as suggested in the Studio help file? Worth some more investigation, I suppose.
-
There's also a FlushResources... I use UnLoad exclusively, maybe it was the only one I got measurable results from, or it's the only one I got to run without errors, can't remember now.