# Tips and Tricks

# Finding who has reference to object that should be have been garbage collected

Imagine object foo = {} that should be garbage collected but you suspect it's not

create class with unique name:

class FINDME {}

add instance of this class to object you want to find:

foo.findme = new FINDME();

Now in memory tab of chrome dev tools, take heap snapshot and search for FINDME. It will be referenced by foo and from there you can find whole reference chain. Happy hunting

Last Updated: 3/24/2020, 10:43:32 AM