ID:1446865
 
(See the best response by LordAndrew.)
Introduction:
So, I'm trying to do a bit of optimizations for my codes. And after reading the documentation on Del proc (world) I decided to ask a bit about whether or not what I am doing here is dangerous.

To prevent accidental hangs during world/Del() from preventing shutdown...

world/Del()
var/savefile/S=new("ServerSettings.sav")
S["allowedSize"]<<allowedSize
S["admin"]<<admin
S["moderator"]<<moderator
S["head moderator"]<<head_moderator
S["muted"]<<muted
S["permitted"]<<permitted
S["request"]<<requestPermission
S["decline"]<<declinedPermission
S["accept"]<<acceptedPermission
S["pagerList"]<<pagerList
S["subList"]<<subList
S["worldHost"]<<worldHost
S["serverList"]<<serverList
S["p1"]<<p1
S["p2"]<<p2
S["hub_msg"]<<hub_msg
..()


Problem:
That's the line that shocked me. Primarily because my game hangs every now and then.

Questions:
I'm wondering, is world/Del() ever called other than when the game is shutting down? Is it called when rebooting?

Another thing that I realized is that when people connect, apparently the RAM increases. It was something I spoke of long ago and I was told that the garbage collector may not be doing its job to clean up the variables instantiated. So, I began adding del(var) to some of the codes that contained var/savefile/S in it. The previous version works.

Past experiences and main purpose of this post:
However, the new version does not have del(S) (And it doesn't because there were other random things I did to try and fix this issue that apparently worked as a miracle). And, I am still confused as to what would fix these hangs. Some information on what is really called when could help me deduce a fix on my codes.
Rebooting the world would cause it to shutdown, so I assume it calls world/Del() since it requires the world and everything in it to be destroyed so the game can be restarted. Once the world is gone, there should be nothing left besides what you saved, as I understand it. If you think that might be an issue, I would rule that out. I don't completely understand what you're trying to articulate, though.
I'm wondering.. If everything is saved after special events when they need to be saved in case of a crash, then I don't really need to have world/Del() do the saving for me. In turn, world/Del() saving for me would be pointless. Am I right?
Another thing.. when calling del(object), what is called?
In response to Xirre
Best response
When you delete something, its destructor method Del() is called, which gives you a chance to do some stuff before an object is deleted. From there, internally DM searches for any and all variables referencing the object you've called up to be deleted and sets those references to null. After that, the object is fully gone because it now has no references pointing to it.
The object's Del() procedure, basically. After that the VM nulls all held references to that object and frees it. Which can be an expensive operation sometimes.

Edit: Post collision, maaaaan.
It's all in the Reference.