ID:1535793
 
(See the best response by Kaiochao.)
Ok so when many npcs are being murdered at once, mob/Del() is being called on all of them, and naturally it is laggy, because I am forcing the garbage collector to activate with each call or something.

But I recently read something that said if I remove all references to an object, then the garbage collector will get rid of it on its own, and that it is much less "laggy".

So does anyone know how to remove all references to an object? They said something about the tag variable but I'm not entirely sure what that has to do with anything.
Best response
Unless you made your own reference variables, the only one you need to worry about is the "contents" variable of the mob's loc. If you set the loc to null, that clears that reference.

If you have any other objects that refer to the mob, it won't get cleaned up.
// some common examples:

// a list of all npcs in existence
var npcs[0]

mob/npc
// who the npc's going after
var/mob/target

obj/projectile
// who fired this projectile
var/mob/owner

// this mob won't be garbage collected if:
// some mob's target == this mob
// or some projectile's owner == this mob
// or this mob is in the global npcs list

Basically, you have to really know what you're doing if you want to take advantage of the garbage collector.
Thanks.

Yea darn I have references to everything everywhere. I guess I can't do it.