• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Things that doesn't leak in galaxy!

Status
Not open for further replies.
Level 23
Joined
Nov 29, 2006
Messages
2,482
Folks, it is true that Blizzard finally put up that garbage collection to work well, but for those of you who don't know, certain object types do still need to be destroyed. Why? Well, there are some info about it in the native.galaxy script file:

[...]
// -- Complex types and automatic deletion --
//
// Many native types represent "complex" objects (i.e. larger than 4 bytes). The script language
// automatically keeps track of these objects and deletes them from memory when they are no longer
// used (that is, when nothing in the script references them any longer). The types which benefit
// from automatic deletion are:
//
// abilcmd, bank, camerainfo, marker, order, playergroup, point,
// region, soundlink, string, text, timer, transmissionsource, unitfilter, unitgroup, unitref,
// waveinfo, wavetarget
//
// Other object types must be explicitly destroyed with the appropriate native function when you
// are done using them.
[...]

In conclusion, whatever object type that isn't on that list needs to be removed manually.
You all are probably familiar with it in wc3 though, I just wanted to give you the notice.

~Eccho~
 
don't*

And yes. It does have leaks. But not serious leaks. It's not possible to destroy them, but using Locals more and more is better than leaking the crap out. In case a map lags, use a smart system to check if they're being used, and if they're not, turn them off. It might be possible to use that to destroy them by turning off triggers.
 
Level 5
Joined
Jul 10, 2010
Messages
124
hey I noticed there is a "convert unit to unit group" function, so are units deleted as well with the unitgroup garbage collector, or do we have to clear units manually?
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
Well, we could take a Dialog as an example. The DialogCreate native does not return any handle object, it is like you're saying, returning a unique int index. This doesn't mean it doesn't leak. We know it has created a dialog for us, so to prevent it from leaking, we do need to destroy the dialog object having that index, in case it should not be used anymore.

Regarding what AionCannonz is saying, I don't know. Units should logically be destroyed when they die.
 
Level 11
Joined
Aug 1, 2009
Messages
963
Well, that seems rather obvious to me. If you create an object, and then you don't destroy it, it does still exists in the game and doesn't just vanish by itself. Don't think anyone expects everything they make to delete itself >_>

I mean, actors and stuff (as well as actor scopes) are automatically destroyed when the die, and I think the relevant stuff we should be mentioning here is things that work like WC3 leaks - where something leaks that you wouldn't normally expect to, ie a seemingly harmless function call.
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
I was referring to it returning an int instead of the actual object. That was the point of the statement, anyways never mind.

How do an actor die?

From what I know of, actorscopes are not automatically destroyed. There is a native "kill" actorscopes. The ActorCreate native takes a actorscope as a parameter, so I would only suppose, that killing an actorscope also kills the actors inside it.
There might be exceptions with actors retained from units and other data objects, as killing a unit is probably killing the actors/actorscopes attached to it.
 
Level 11
Joined
Aug 1, 2009
Messages
963
No, I mean I'm pretty sure it stated somewhere that actor scopes are automatically destroyed when all of the actors inside them are destroyed (and actors are destroyed if their actorscope is destroyed).

It might cause a problem if you explicitly create a new actorscope (as it wouldn't know to destroy it), but when using the ActorCreate native, you can just use "null" as the argument for the scope, thus not causing any problems.
 
Status
Not open for further replies.
Top