How can I determine what objects are being collected by the garbage collector?

后端 未结 4 485
南方客
南方客 2020-12-29 08:39

I have significant garbage collection pauses. I\'d like to pinpoint the objects most responsible for this collection before I try to fix the problem. I\'ve looked at the hea

4条回答
  •  时光说笑
    2020-12-29 09:05

    Take a look at https://developers.google.com/chrome-developer-tools/docs/heap-profiling

    especially Containment View

    The Containment view is essentially a "bird's eye view" of your application's objects structure. It allows you to peek inside function closures, to observe VM internal objects that together make up your JavaScript objects, and to understand how much memory your application uses at a very low level.

    The view provides several entry points:

    DOMWindow objects — these are objects considered as "global" objects for JavaScript code; GC roots — actual GC roots used by VM's garbage collector; Native objects — browser objects that are "pushed" inside the JavaScript virtual machine to allow automation, e.g. DOM nodes, CSS rules (see the next section for more details.) Below is the example of what the Containment view looks like:

    enter image description here

提交回复
热议问题