Use Chrome's profiler to find JS memory leak

Source: Internet
Author: User
Tags ranges

1. First, a test environment must be fixed. Specifically, select one of the actions that can be repeated as a standard test action.

2. After refreshing the browser, use Profiler to grasp the heap snapshot.

3. Perform the operation, and once again grasp the snapshot and repeat the comparison several times.

As seen in the comparison page, these objects are growing between multiple snapshot. Investigate this object in depth

Found a very strange method to call.

We found our code.

var domselectionselectrangesmethod =function  (ranges) {    try  {        Domselectionselectrangesmethod.call (this, ranges);     Catch (e) {    }};

Then look at the source code of CKEditor, found in CKEditor, selection is just a constructor, Selectranges is the method of the prototype.
The problem code could not modify the method on the prototype, but wrapped it over and over again in vain on the constructor. The context of these methods causes a memory leak.

Use Chrome's profiler to find JS memory leak

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.