• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Does variables on SCII edit leaks??

Status
Not open for further replies.
Level 9
Joined
Nov 4, 2007
Messages
933
Is your variable global or local? If its local it should be automatically cleaned up by the garbage collector in the trigger, if its global it'll keep it set to whatever point its currently on, and clean up the unused ones it may have been previously set to.
 
Level 2
Joined
Aug 2, 2010
Messages
17
Short answer: no, it will not leak. Galaxy automatically garbage collects point objects when they go out of scope (i.e. there are no remaining references to those objects in any reachable code).

A list of object types that are automatically garbage collected are:

abilcmd, bank, camerainfo, marker, order, playergroup, point, region, soundlink, string, text, timer, transmissionsource, unitfilter, unitgroup, unitref, waveinfo, wavetarget
 
Level 2
Joined
Aug 2, 2010
Messages
17
Everything that is an object, aka not primitive to galaxy is cleaned up automatically.

That's not entirely true. Only certain objects benefit from automatic garbage collection (see the list in my post above). Other objects you DO have to remove yourself, but these are usually objects automatic garbage collection would be impossible for, since there are many situations in which they should remain around even if no galaxy code references them, like triggers and units.
 
Level 10
Joined
Nov 28, 2008
Messages
655
That's not entirely true. Only certain objects benefit from automatic garbage collection (see the list in my post above). Other objects you DO have to remove yourself, but these are usually objects automatic garbage collection would be impossible for, since there are many situations in which they should remain around even if no galaxy code references them, like triggers and units.

Being nit-picky, yes.

But as far as what we had to deal with before, things like points, groups, etc... don't need to be cleaned up by hand anymore. Did you get that list from the natives.txt? I am not at my comp to check, that is a list from the programmers, and would be 100% accurate, just making sure you got them all.


Does anyone know if you can manually release the memory? or do we HAVE to rely on the collector?

Cuz it would be nice to shut the collector off, and do it all ourselves, would speed some things up.

And also, anyone know if we can set the collector at all? Again, thinking speed, if we could slow it down or something, maybe we can help with lag on maps.

Just some ideas.
 
Level 2
Joined
Aug 2, 2010
Messages
17
Yea, I got that list from the native library. And no, you can't manually destroy those objects, since blizz didn't provide the appropriate functions to do so.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
The deallocation code probably automatically destroys objects once all references to them are lost, or atleast adds them to a heap to be processed at a later time.

No, variables should not leak in SC2 cause blizzard said this time they actually took time in planning the script language so leaks were near impossible. However do keep in mind that it can only clean up stuff that has no references to it, so the object will still remain in the case of globals till the global is asigned a different value.

Also types that are not recycled cause they may still be physically useful will be leak prone. For example making a million dialog buttons which are invisible could be classed as a leak and may cause performance reductions. However blizzard was smart enough to forsee this issue and gave an instruction that if something unsafe like that was happening you could clear all dialog items created and thus clean all the leaks. Also many types use plain integers as references and thus custom code could be written to handle any leak chances.

Currently the only thing I know for sure that leaks are actors. If you forget in the data editor to give an actor a destructor or do not run one via triggers it will visually leak. However the difference is that this sort of data is impossible to automatically deleak due to how it may be used. For example after a once off event people might want to leak some actors so that the location looks changed for the rest of the game.
 
Level 13
Joined
Jun 5, 2008
Messages
504
What about points and stuff if they are not in variable, do they leak then?

Like

Sample1:
Spawn 1 unit to possition of triggering unit


Sample2:
Set pos1 = possition of triggering unit
Spawn 1 unit to pos1


Sample1 leaks, sample2 doesnt?
 
Status
Not open for further replies.
Top