mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-28 11:02:41 +00:00
Revert "Merge branch 'master' of https://github.com/PolarisSS13/Polaris into NanoGrade"
This reverts commit6bb5409349, reversing changes made tof6a83d5ee0.
This commit is contained in:
@@ -66,9 +66,6 @@ world/loop_checks = 0
|
||||
testing("GC: [refID] old enough to test: GCd_at_time: [GCd_at_time] time_to_kill: [time_to_kill] current: [world.time]")
|
||||
#endif
|
||||
if(A && A.gcDestroyed == GCd_at_time) // So if something else coincidently gets the same ref, it's not deleted by mistake
|
||||
#ifdef GC_FINDREF
|
||||
LocateReferences(A)
|
||||
#endif
|
||||
// Something's still referring to the qdel'd object. Kill it.
|
||||
testing("GC: -- \ref[A] | [A.type] was unable to be GC'd and was deleted --")
|
||||
logging["[A.type]"]++
|
||||
@@ -91,47 +88,29 @@ world/loop_checks = 0
|
||||
#undef GC_COLLECTIONS_PER_TICK
|
||||
|
||||
#ifdef GC_FINDREF
|
||||
|
||||
/datum/controller/process/garbage_collector/proc/LocateReferences(var/atom/A)
|
||||
testing("GC: Attempting to locate references to [A] | [A.type]. This is a potentially long-running operation.")
|
||||
if(istype(A))
|
||||
if(A.loc != null)
|
||||
testing("GC: [A] | [A.type] is located in [A.loc] instead of null")
|
||||
if(A.contents.len)
|
||||
testing("GC: [A] | [A.type] has contents: [jointext(A.contents)]")
|
||||
var/ref_count = 0
|
||||
for(var/atom/atom)
|
||||
ref_count += LookForRefs(atom, A)
|
||||
for(var/datum/datum) // This is strictly /datum, not subtypes.
|
||||
ref_count += LookForRefs(datum, A)
|
||||
for(var/client/client)
|
||||
ref_count += LookForRefs(client, A)
|
||||
var/message = "GC: References found to [A] | [A.type]: [ref_count]."
|
||||
if(!ref_count)
|
||||
message += " Has likely been supplied as an 'in list' argment to a proc."
|
||||
testing(message)
|
||||
|
||||
/datum/controller/process/garbage_collector/proc/LookForRefs(var/datum/D, var/datum/A)
|
||||
/datum/controller/process/garbage_collector/proc/LookForRefs(var/datum/D, var/list/targ)
|
||||
. = 0
|
||||
for(var/V in D.vars)
|
||||
if(V == "contents")
|
||||
continue
|
||||
if(!islist(D.vars[V]))
|
||||
if(D.vars[V] == A)
|
||||
if(istype(D.vars[V], /atom))
|
||||
var/atom/A = D.vars[V]
|
||||
if(A in targ)
|
||||
testing("GC: [A] | [A.type] referenced by [D] | [D.type], var [V]")
|
||||
. += 1
|
||||
else
|
||||
. += LookForListRefs(D.vars[V], A, D, V)
|
||||
else if(islist(D.vars[V]))
|
||||
. += LookForListRefs(D.vars[V], targ, D, V)
|
||||
|
||||
/datum/controller/process/garbage_collector/proc/LookForListRefs(var/list/L, var/datum/A, var/datum/D, var/V)
|
||||
/datum/controller/process/garbage_collector/proc/LookForListRefs(var/list/L, var/list/targ, var/datum/D, var/V)
|
||||
. = 0
|
||||
for(var/F in L)
|
||||
if(!islist(F))
|
||||
if(F == A || L[F] == A)
|
||||
if(istype(F, /atom))
|
||||
var/atom/A = F
|
||||
if(A in targ)
|
||||
testing("GC: [A] | [A.type] referenced by [D] | [D.type], list [V]")
|
||||
. += 1
|
||||
else
|
||||
. += LookForListRefs(F, A, D, "[F] in list [V]")
|
||||
if(islist(F))
|
||||
. += LookForListRefs(F, targ, D, "[F] in list [V]")
|
||||
#endif
|
||||
|
||||
/datum/controller/process/garbage_collector/proc/AddTrash(datum/A)
|
||||
|
||||
Reference in New Issue
Block a user