Closed Bug 1453436 Opened 7 years ago Closed 4 years ago

Firefox is consuming 22 GB of Ram while using Dev Tools

Categories

(DevTools :: General, defect, P2)

59 Branch
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1682212

People

(Reporter: cristiancehi, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

(deleted), application/octet-stream
Details
Attached file memory-report.json.gz (obsolete) (deleted) —
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:59.0) Gecko/20100101 Firefox/59.0 Build ID: 20180323154952 Steps to reproduce: I'm developing a React App, so I'm using the Dev Tools a lot. I don't 100% know the root cause of the memory leak, but it slows my developing time because I have to restart the system (due slow memory decompression and swap usage) twice or trice a day. I have less than 15 tabs open, and only on one I have the dev tools open. Actual results: I'm sharing the memory report, I don't fully understand it, the result is Huge Memory Usage, even under 12 tabs open. Expected results: I hope this is not the casual memory requirements for developing.
I don't know how to read memory reports, but I can see 219 instances of resource:\\\\devtools\\client\\debugger\\new\\parser-worker.js and 52 instances of resource:\\\\devtools\\client\\debugger\\new\\search-worker.js. Seems like an awful lot of them to me. In any case, 22GB is not normal. And having to restart Firefox either. It certainly seems like there's a leak somewhere. Do you see memory usage going up and up as you use Firefox? It could be good to also test using Firefox without addons (I'm assuming you're using the React DevTools addon at least), for some period of times, with DevTools open, and seeing if the leak persists there. This might be a similar bug as bug 1376753.
Flags: needinfo?(cristiancehi)
From the memory report, I think this is rather 2.2GB. This is still huge, but less strange. The debugger's parser-worker Worker holds 914 MB. I can see 140MB and 138MB for 2 debugger windows (not sure why) 193MB taken by the react addon Some strings that seem to be javascript code, I don't know if this hold by devtools or the addon. Also I see there's only one main process in this memory report, no content process. Do you disable our multi-process architecture ?
Product: Firefox → DevTools
Priority: -- → P3
I fixed an issue in the debugger search worker that may be related to this issue. https://github.com/devtools-html/debugger.html/pull/7023 When searching the contents of a source using regular expressions that could return a zero length match such as /*a/ an inifiate loop would occur in the search worker that would keep adding to an array, causing several GB memory usage as well as high CPU usage. I think the fix has landed in the Nightly build.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Flags: needinfo?(cristiancehi)
Resolution: --- → INACTIVE
Attached file memory-report.json.gz (deleted) —

Hi! I'm sorry I didn't update about this before. I didn't know how to do it.

But today I reproduced the bug because one year has passed and this wasn't reported by anyone. So I restored all my settings to default and the process deleted all my extensions. I proceeded to open one tab with the react app I'm doing for my job and kept reloading it (through changes in the code and webpack reload) and after 100+ iterations I ended having like 6+ GB in the Main Process and 6+ GB in a FirefoxCP Web Content Process.

This file I'm attaching I hope it's complete and useful.

I got the CC and GC logs too, but i'm reserving those to upload if they're really needed.

PS. I notice that in my laptop computer I use in my workplace (Ubuntu) there is also a memory leak. I need to restart Firefox or even worse when swap is heavily used because this I need to restart the computer.

Attachment #8967107 - Attachment is obsolete: true
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: INACTIVE → ---

Sorry, I forgot to mention. The Web Developer Tools have to be open. I tested the same method I mentioned an hour ago without Web Developer Tools and no memory leak occurred.

Blocks: 1553178
No longer blocks: devtools-performance
Blocks: dt-leak
No longer blocks: 1553178

I have this problem too.
The consumed memory never releases after reloading the page. It just releases when the tab completely closed or killed.

Of course, it just occurs when the Developer Tools is open.

(In reply to Mostafa Lavaei from comment #6)

I have this problem too.
The consumed memory never releases after reloading the page. It just releases when the tab completely closed or killed.

Do you have more details about what you've been doing and what page were opened?
E.g. where you extensively using the Debugger, running workers or executing a lot of XHRs, etc..?

Any chance to provide a test case?

Honza

Flags: needinfo?(twco)

it's obviously a memory leak and does not depend on XHRs or anything else. Yes, if i use a lot of XHRs, the memory will full faster.
I've experienced it in serveral projects and on different machines. But for the test case, you can create a new project using Angular Framework and just add a <video> tag (just for making your memory full faster, you can skip it). Then refresh the page manully or change the code and let Dev Server refresh the page for you. During these refreshes your Dev Tools must be open. Of course if you check the Disable Cache option, your memory will become full faster. You can track the memory usage of "Web Content" process (In the Ubuntu). You will see the memory usage increases after each refresh and firefox never free it after refresh.

Flags: needinfo?(twco)

Thanks for quick update!

Any chance you could provide/attach the Angular app, so we can run it and reproduce the issue on our machines?
I don't have much experience with Angular myself, so it would be great help!

Thanks,
Honza

Flags: needinfo?(twco)

I share it in the Github.
Please read the README.md for more details.

Flags: needinfo?(twco)

@Mostafa: awesome, thanks for the test app!

I can easily reproduce the problem on my machine (Nightly, Win10) using the app here:
https://github.com/Lavaei/firefox-memory-leak

I am seeing a lot of memory allocated in the content process as well as in the main process.

The main process also reports explicit allocations for strings (seems to be sources), see about:memory

574.01 MB (47.46%) -- string(length=1048576, copies=287, "(window["webpackJsonp"] = ...
143.51 MB (11.87%) -- string(length=144704, copies=287, "(window["webpackJsonp"] = ...
...

You can also see the attached memory report, it shows the same.

Alex, are we leaking sources here?

Honza

Has STR: --- → yes
Flags: needinfo?(poirot.alex)
Priority: P3 → P2
Depends on: 1673550
No longer depends on: 1672778
  • the page does an actual reload (we do navigate)
  • there's no worker on the content page
  • I think this only occurs once the debugger is open (opening only the console, I don't see this increase in memory)
  • we seems to have a new copy of the source string on each reload (see copies=287)
  • there are source maps on the page, and the source map worker is consuming memory (sometimes there's 2 copies of the sourcemap file), but it doesn't grow

(Nicolas is looking into this)

Flags: needinfo?(poirot.alex)

This seems to highlight the same issues as Bug 1682212: leaked strings, sourcemap worker etc.
Will close as duplicate and mention the test project provided here (thanks for that!) in the other bug.

Status: REOPENED → RESOLVED
Closed: 6 years ago4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: