From 0a64aacfa4bdd84020dcf79f47af4b1a67051f3e Mon Sep 17 00:00:00 2001 From: fira Date: Mon, 6 Nov 2023 03:36:30 +0100 Subject: [PATCH] Fixes GC deletion issues around reagents (#4833) # About the pull request Fixes a potential GC consistency issue around reagents and reagents_containers In theory this should do nothing because `reagents` is *supposed* to get soft GC'ed anyway when it is swapped out. There is something more to it somewhere, because on live bottles get deleted and retain their `reagents`. In this case it's a circular reference preventing deletion. # Explain why it's good for the game backend consistency / long term performance --- .../objects/items/reagent_containers/reagent_container.dm | 6 ------ code/modules/reagents/Chemistry-Holder.dm | 1 + 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/code/game/objects/items/reagent_containers/reagent_container.dm b/code/game/objects/items/reagent_containers/reagent_container.dm index e0561d5a7e3d..327f6ba1ce1c 100644 --- a/code/game/objects/items/reagent_containers/reagent_container.dm +++ b/code/game/objects/items/reagent_containers/reagent_container.dm @@ -67,12 +67,6 @@ if (N) R.amount_per_transfer_from_this = N -/obj/item/reagent_container/Initialize() - . = ..() - if (!possible_transfer_amounts) - verbs -= /obj/item/reagent_container/verb/set_APTFT //which objects actually uses it? - create_reagents(volume) - /obj/item/reagent_container/Destroy() possible_transfer_amounts = null return ..() diff --git a/code/modules/reagents/Chemistry-Holder.dm b/code/modules/reagents/Chemistry-Holder.dm index 643130559e94..2c08e9f4e693 100644 --- a/code/modules/reagents/Chemistry-Holder.dm +++ b/code/modules/reagents/Chemistry-Holder.dm @@ -713,5 +713,6 @@ // Convenience proc to create a reagents holder for an atom // Max vol is maximum volume of holder /atom/proc/create_reagents(max_vol) + QDEL_NULL(reagents) reagents = new/datum/reagents(max_vol) reagents.my_atom = src