From edc7cfd63a7d7f3fc9b1a92aa4201bcbfa41b548 Mon Sep 17 00:00:00 2001 From: MrPerson Date: Sun, 23 Feb 2014 18:07:33 -0800 Subject: [PATCH] Make GC'd objects super invisible to help unreference them more. qdel() and clear contents of things when they themselves are qdel() Forgot to add the gc_cost to the total cost of the MC. --- code/controllers/garbage.dm | 2 ++ code/controllers/master_controller.dm | 2 +- code/game/atoms.dm | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/code/controllers/garbage.dm b/code/controllers/garbage.dm index 1c74b84cb4d..827eca89210 100644 --- a/code/controllers/garbage.dm +++ b/code/controllers/garbage.dm @@ -45,6 +45,7 @@ var/list/uncollectable_vars=list( continue // testing("GC: Unsetting [vname] in [A.type]") A.vars[vname] = null + A.invisibility = 101 // Idea by ChuckTheSheep to make the object even more unreferencable // testing("GC: Pop([A.type]) - destroyed\[\ref[A]\] = [A.gc_destroyed] current time: [world.timeofday]") destroyed["\ref[A]"] = A.gc_destroyed queue.Cut(1, 2) @@ -79,6 +80,7 @@ var/list/uncollectable_vars=list( // else // testing("GC: [refID] properly GC'd at [world.timeofday] with timeout [GCd_at_time]") destroyed.Cut(i, ++i) // also increases i in general + /** * NEVER USE THIS FOR ANYTHING OTHER THAN /atom/movable * OTHER TYPES CANNOT BE QDEL'D BECAUSE THEIR LOC IS LOCKED OR THEY DON'T HAVE ONE. diff --git a/code/controllers/master_controller.dm b/code/controllers/master_controller.dm index 2947715b661..45d1af27ccf 100644 --- a/code/controllers/master_controller.dm +++ b/code/controllers/master_controller.dm @@ -208,7 +208,7 @@ datum/controller/game_controller/proc/process() gc_cost = (world.timeofday - timer) / 10 //TIMING - total_cost = air_cost + sun_cost + mobs_cost + diseases_cost + machines_cost + objects_cost + networks_cost + powernets_cost + nano_cost + events_cost + ticker_cost + total_cost = air_cost + sun_cost + mobs_cost + diseases_cost + machines_cost + objects_cost + networks_cost + powernets_cost + nano_cost + events_cost + ticker_cost + gc_cost var/end_time = world.timeofday if(end_time < start_time) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index af1b824b185..d4aa0788b7e 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -55,6 +55,8 @@ // Also called on del() /atom/proc/Destroy() gc_destroyed = world.timeofday + for(var/atom/movable/AM in contents) + qdel(AM) if(reagents) reagents.delete() del(reagents) // Technically I think the reagent holder will gc, but let's be careful here and delete all the reagents and the holder too