im a bit confused on hte specifics of what does and doesn't cause memory leaks / bad performance in sc2 modding. how to global variables vs local variables effect speed and memory leaking? (im asking in reference to a few posts ive seen that apparently the community knows something i dont).
from what i do understand is actors can create 'leaks' of sorts in that if you create one and dont 'kill' it or remove it then it stays in memory and seemingly 'leaks' of sorts. i see this auto-colelcted by the event manager of the actor, but you have to 'kill' the actor. there is an event> 'on death' action -> destroy {||} or something like that, that i see as auto put in for every actor kinda like the on birth event. so as long as you 'kill' it or it dies, you shouldnt have to 'remove' it as they are both connected provided you dont delete that event (im not even sure if you can as ive never wanted to try) anyone know anything solid here???
I don't think you really need to worry about things like that. SC2 seems very good in cleaning up it's own mess.
Also, a couple of memory leaks will not make your map unplayable. You'd need.. thousands and thousands of leaks to even see an impact.
Reading and writing local and global variables shouldn't make much difference at all, since both things basically work the same way. Creating the local variable takes a little bit of time, but that's nothing to worry about. Local variables also don't seems to leak at all, or at least it's much less than in WC3.
Bad performance doesn't really have anything to do with memory leaks. Your triggers have a worse performance the more functions calls you have. Basically try to avoid using things like Get Dying Unit / Get Unit Position / Get Last Created XXX / Get Whatever.. several times, but instead store them in a local variable. Usually I use a variable when I have to use the same function call more than 3 times.
But it actually isn't THAT important. Galaxy is a nice bit faster than the lame JASS2 we've been using for years. I don't think any of my triggers have created lag yet (unless I've screwed up horribly).
im a bit confused on hte specifics of what does and doesn't cause memory leaks / bad performance in sc2 modding. how to global variables vs local variables effect speed and memory leaking? (im asking in reference to a few posts ive seen that apparently the community knows something i dont).
from what i do understand is actors can create 'leaks' of sorts in that if you create one and dont 'kill' it or remove it then it stays in memory and seemingly 'leaks' of sorts. i see this auto-colelcted by the event manager of the actor, but you have to 'kill' the actor. there is an event
> 'on death' action-> destroy {||} or something like that, that i see as auto put in for every actor kinda like the on birth event. so as long as you 'kill' it or it dies, you shouldnt have to 'remove' it as they are both connected provided you dont delete that event (im not even sure if you can as ive never wanted to try) anyone know anything solid here???I don't think you really need to worry about things like that. SC2 seems very good in cleaning up it's own mess.
Also, a couple of memory leaks will not make your map unplayable. You'd need.. thousands and thousands of leaks to even see an impact.
Reading and writing local and global variables shouldn't make much difference at all, since both things basically work the same way. Creating the local variable takes a little bit of time, but that's nothing to worry about. Local variables also don't seems to leak at all, or at least it's much less than in WC3.
Bad performance doesn't really have anything to do with memory leaks. Your triggers have a worse performance the more functions calls you have. Basically try to avoid using things like Get Dying Unit / Get Unit Position / Get Last Created XXX / Get Whatever.. several times, but instead store them in a local variable. Usually I use a variable when I have to use the same function call more than 3 times.
But it actually isn't THAT important. Galaxy is a nice bit faster than the lame JASS2 we've been using for years. I don't think any of my triggers have created lag yet (unless I've screwed up horribly).
good to know, kidna what i was thinking myself, but thanks for the input