ID:137620
 
Am I correct in remembering that the handling of items at null was such that if there is no other reference to the item, it will be garbage collected if it's at null?

This behavior determines how I handle some administrative objects.
Deadron wrote:
Am I correct in remembering that the handling of items at null was such that if there is no other reference to the item, it will be garbage collected if it's at null?

Yes. The item must also contain no references to other objects (eg, in its contents). Recall that the purpose of this behavior is to allow objs & mobs (which are always located in world.contents) to be garbage collected.
In response to Tom
Tom wrote:
Deadron wrote:
Am I correct in remembering that the handling of items at null was such that if there is no other reference to the item, it will be garbage collected if it's at null?

Yes. The item must also contain no references to other objects (eg, in its contents). Recall that the purpose of this behavior is to allow objs & mobs (which are always located in world.contents) to be garbage collected.

I also should point out that mobs with non-null clients won't be garbage-collected even if they are at null, so you don't have to worry about a player suddently being disconnected just because you move him off the map. I can't remember if this also applies to non-null keys as well; perhaps that would be the better behavior.

And the easiest way to prevent garbage collection is to just make a self-referencing object, eg:

mob/var/ptr = src
In response to Tom

I can't remember if this also applies to non-null keys as well; perhaps that would be the better behavior.

Yes. Any mob with a non-null key is considered "blessed" and will never be removed by the garbage collector, even if the client disconnects. That behavior will not change, but it is, admittedly, somewhat obscure. If you think that dependence on this fact makes your code harder to understand, then either bless the object yourself (with a self-reference) or add a comment or both.
In response to Dan
Dan wrote:
I can't remember if this also applies to non-null keys as well; perhaps that would be the better behavior.

Yes. Any mob with a non-null key is considered "blessed" and will never be removed by the garbage collector, even if the client disconnects. That behavior will not change, but it is, admittedly, somewhat obscure. If you think that dependence on this fact makes your code harder to understand, then either bless the object yourself (with a self-reference) or add a comment or both.

In this case I was actually more worried about some objects never getting collected!

As it is I'm manually deleting them anyway, just so I'm not relying on "invisible" procedure.
Administrative objects? Could it not be handled with datums?
In response to Spuzzum
Spuzzum wrote:
Administrative objects? Could it not be handled with datums?

No. They are placeholder objects that show up in statpanels.