Aleksandar Toplek
Aleksandar Toplek

Reputation: 2821

Chrome extension using jQuery leaks memory

I'm currently developing an extension that uses content scripts (jquery is one of content scripts) and I have noticed that page gets slow with long use. Page is not dynamic, but rather it refreshes on every click (goes to different page on button click). If I open Task Manager I can clearly see that content scripts are responsible for memory leak.

Extension disabled (after ~20 refreshes)

Extension disabled

Enabled (after ~20 refreshes)

Extension enabled

I have narrowed leak down to jQuery & jQueryUI scripts by removing all other scripts and confirming that by removing jQuery scripts ass well so that then leak is not present anymore.

I'm using latest version of jQuery and I don't see this leak in other pages that use it.

Is there anything I can do to at least reduce memory leaks?

-- EDIT

Extension is Project-Axeman so you can take a look if you think it's something else that leaks.

-- UPDATE

I have replaced jQuery with beta version and problem persists...

Upvotes: 1

Views: 934

Answers (1)

Sudarshan
Sudarshan

Reputation: 18524

There are Heap Profile Demo's using developer tools of chrome, with these you can get

  • Overview of the space occupied by the objects
  • Garbage left by actions through multiple invocations
  • Inspect variables of closures, and peek into objects internals
  • Uncovering DOM Leaks and lot more

How ever, there are some other options in task manager, which give more detail than abstract memory value.

enter image description here

Upvotes: 1

Related Questions