If you have a global variable or maybe an event callback with a variable that hasn’t been cleaned up that is referencing an entity object, while the internals of the entity are destroyed, JS will still keep the object in memory as there is still a reference to it.
Again, without a repro or seeing more code, it is hard to tell what could be the issue.