Javascript Memory Leaks: Detached DOM tree

后端 未结 2 1232
醉话见心
醉话见心 2020-12-23 11:27

I have noticed that the memory of the browser starts increasing whilst I am in a form (this is noticeable from the task manager). In IE 9, this goes easily over 500MB after

2条回答
  •  时光取名叫无心
    2020-12-23 12:23

    Looks like your code creates many DOM subtrees and keeps references to it from javascript. You need to select an element from a Detached dom tree. According to the snapshot you should select Text element. And look into the retainers tree.

    This tree shows you all the paths that keeps the object alive. At least one path, usually the shortest one, will lead you to the window object. If you familiar with the code then you may easily find the object in that path that has to be deleted but it doesn't. There can be many such objects in the path. The object with the smallest distance is more interesting.

提交回复
热议问题