Right now, I use the following
(WARNING: Bad code, just slapped it to together to get an instance count.)
/debug_item_track
var/path_type = ""
var/count = 1
New(var/i)
src.path_type = i
mob/Stat()
statpanel("Debug Atom Counts")
var/list/counter = list()
for(var/obj/A)
var/found_one = FALSE
for(var/debug_item_track/D in counter)
if("[D.path_type]" == "[A.type]") {D.count += 1; found_one = TRUE; break}
if(!found_one) {counter.Add(new /debug_item_track("[A.type]"))}
for(var/mob/A)
var/found_one = FALSE
for(var/debug_item_track/D in counter)
if("[D.path_type]" == "[A.type]") {D.count += 1; found_one = TRUE; break}
if(!found_one) {counter.Add(new /debug_item_track("[A.type]"))}
for(var/debug_item_track/t in counter)
stat(t.path_type, t.count)
The only problem with this, is I believe it's stopping the garbage collector from actually working?
I see specific objects that are in the list, when they shouldn't be, as they are just overlays.
See screenshot for example:
![](http://puu.sh/5BAg6.png)
I genuinely am not sure if it's my code above that's preventing garbage collection, or if it's an issue with my hud engine not cleaning up after creation.
It's difficult to tell, because if I disable the code above, I'll have no way of knowing if the garbage collector has picked it up or not.
~~~~~~~~~
In the Profile Tab, can we have the ability to see how many instances of each object there currently is in a world?
I'm surprised there isn't something similar to this already!
+1! :)