Firefox parent process has very high memory usage and a large number of "ports"
Categories
(Core :: Performance: General, defect, P2)
Tracking
()
| Performance Impact | medium |
People
(Reporter: adzio, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: perf:resource-use, Whiteboard: [mac:stability])
Attachments
(7 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:85.0) Gecko/20100101 Firefox/85.0
Steps to reproduce:
I've been "a loyal Firefox user" for years.
This issue has persisted in this application for years on different MacOS hardware and is yet to be fixed. Very frustrating.
After upgrading my machine to 64GB of memory, I'm still seeing firefox hogging most of the machine's memory (I'm down to 14GB free out of 64GB ATM) with no other major applications running. At this point with so much otherwise free memory available this is unacceptable.
If this is not taken seriously and fixed I'll be moving to a different browser application.
Machine specs: MacOS 10.15.7 Mac Mini, 64GB memory (
PhysMem: 50G used (6064M wired), 14G unused)
Steps to reproduce:
- Install Firefox
- Use Firefox normally (open tabs, keep them open to refer to them later, put the machine to sleep and wake it up, etc.)
- See the memory usage by firefox process go up to 2.4 GB and plugin-containers to 800-900MB each.
Actual results:
See the memory usage by firefox process go up to 2.4 GB and plugin-containers to 800-900MB each. Insane.
In the past, on a machine with smaller memory, I would run out of memory very fast, and was forced to force-kill the plugin-container processes to free up memory (which would cause the websites in firefox tabs to crash).
There would be a slow degradation after a few weeks of normal computer usage, with each return from sleep taking longer and longer.
What's worse, the computer crashed a few times when the hard disk swapping induced by firefox's out-of-control memory usage caused disk thrashing so big that it exceeded the timeout of the watchdog (2 minutes), initiating an automatic system restart, forcing me to lose the contents of the tabs.
top -o mem:
Processes: 430 total, 3 running, 427 sleeping, 1865 threads
12:04:53 Load Avg: 2.97, 2.98, 2.73
CPU usage: 5.30% user, 7.30% sys, 87.38% idle
SharedLibs: 680M resident, 83M data, 279M linkedit.
MemRegions: 101374 total, 4913M resident, 254M private, 3350M shared.
PhysMem: 50G used (6084M wired), 14G unused.
VM: 2656G vsize, 1998M framework vsize, 0(0) swapins, 0(0) swapouts.
PID COMMAND %CPU TIME #TH #WQ #PORTS MEM PURG CMPR
1274 firefox 16.2 26:50:21 97 3 105022+ 2522M+ 280M 0B
1281 plugin-conta 0.8 06:10:09 36 1 4695 1111M+ 0B 0B
1279 plugin-conta 0.7 06:27:00 36 1 12569 997M 0B 0B
6332 plugin-conta 0.5 02:13:33 36 1 2475 934M+ 0B 0B
1298 plugin-conta 1.6 05:17:03 37 1 2486 866M+ 0B 0B
17579 com.apple.We 0.0 12:17.76 8 2 208 816M 27M 0B
1566 plugin-conta 0.8 01:57:17 38 1 2322 797M 0B 0B
1303 plugin-conta 0.5 05:48:27 37 1 2852 796M 0B 0B
4042 com.apple.We 0.0 28:20.90 14 3 289 727M+ 112K 0B
1297 plugin-conta 0.8 02:09:52 38 1 2070 725M 0B 0B
1304 plugin-conta 2.0 05:09:49 46/1 1 2258 590M 0B 0B
260 WindowServer 3.5 04:39:31 11 5 2913 329M 4000K- 0B
Expected results:
Firefox needs to be be much much better at managing memory. The firefox process should not "grow to fit the container" which is the available free memory. The process should keep a tab on its own memory usage and of the processes spawned by the websites that are in its open tabs, like plugin-container etc.
Implement a cap on memory usage for yourself and for the processes spawned by you.
Fix it!!!!
Updated•5 years ago
|
Comment 6•5 years ago
|
||
The main process has about 840MB of explicit, which is about what I'm seeing in my own Firefox. However, resident-unique is about 1.5GB. I'm not sure where the extra memory is coming from. The main process also has shmem-mapped of 1.7GB, so maybe it is shared memory somehow?
The report has around 680MB of image stuff under gfx/webrender, so maybe this is WebRender related somehow? We've had a few issues with WebRender memory usage that have been fixed, but I don't know if they are in 85 yet or not. gfx/webrender/images/mapped_from_owner has 355MB whereas my own machine has only 74MB in there.
Comment 8•5 years ago
|
||
I don't think the CC or GC logs will be useful here, because the high memory usage doesn't appear to be associate with web pages per se.
In addition to the bloated main process there are also the sizes of plugin-container processes (tied to firefox) which based on the top -o mem output above total at least 6GB. This plugin-container hogging behavior has been like this for a while, too.
Since images are a vital part of any web experience, memory leak related to images is a pretty big problem, right?
I'm not sure why the self-reported size is only a few gigs (2.5GB), I could bet a lot of money that if I quit Firefox right now the memory usage would drop from 51GB to 5-6GB (OS only) immediately.
As firefox continues to run I'm down to 13GB free mem out of 64GB atm. Why so many open ports and cached files?
Physical memory: 64GB
Memory used: 32GB
Cached files: 24GB (!?!?)
App memory: 26GB
Wired memory: 5.91GB
Open ports: 108703
Swap used: 0B
Comment 10•5 years ago
|
||
Markus, shot in the dark here, but does anything here stand out to you? (Linking you in on the suspicion that this might be Mac-specific 🤷♂️)
Comment 11•5 years ago
|
||
This sounds like bug 1691136. I think something we're doing causes the graphics driver to leak GPU memory.
Adam, can you post the contents of the Graphics section on about:support here? Maybe we can find a specific driver or OS version on which this happens, by comparing this information between multiple reports.
The one thing that stands out to me from the top output in comment 0 is the #PORTS 105022+ value. For a comparison, my Firefox currently has 1176 ports.
Updated•5 years ago
|
Comment 12•5 years ago
|
||
Actually, I'm not sure anymore that it's that bug. That bug has dozens of gigabytes of Firefox memory usage, whereas this one has 2.4GB. That's still a lot but not quite as horrendous.
| Reporter | ||
Comment 13•5 years ago
|
||
Features
Compositing WebRender
Asynchronous Pan/Zoom wheel input enabled; scrollbar drag enabled; keyboard enabled; autoscroll enabled; smooth pinch-zoom enabled
WebGL 1 Driver WSI Info CGL
IsWebglOutOfProcessEnabled: 0
WebGL 1 Driver Renderer Intel Inc. -- Intel(R) UHD Graphics 630
WebGL 1 Driver Version 4.1 INTEL-14.7.11
WebGL 1 Driver Extensions GL_ARB_blend_func_extended GL_ARB_draw_buffers_blend GL_ARB_draw_indirect GL_ARB_ES2_compatibility GL_ARB_explicit_attrib_location GL_ARB_gpu_shader_fp64 GL_ARB_gpu_shader5 GL_ARB_instanced_arrays GL_ARB_internalformat_query GL_ARB_occlusion_query2 GL_ARB_sample_shading GL_ARB_sampler_objects GL_ARB_separate_shader_objects GL_ARB_shader_bit_encoding GL_ARB_shader_subroutine GL_ARB_shading_language_include GL_ARB_tessellation_shader GL_ARB_texture_buffer_object_rgb32 GL_ARB_texture_cube_map_array GL_ARB_texture_gather GL_ARB_texture_query_lod GL_ARB_texture_rgb10_a2ui GL_ARB_texture_storage GL_ARB_texture_swizzle GL_ARB_timer_query GL_ARB_transform_feedback2 GL_ARB_transform_feedback3 GL_ARB_vertex_attrib_64bit GL_ARB_vertex_type_2_10_10_10_rev GL_ARB_viewport_array GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_framebuffer_multisample_blit_scaled GL_EXT_texture_compression_s3tc GL_EXT_texture_filter_anisotropic GL_EXT_texture_sRGB_decode GL_APPLE_client_storage GL_APPLE_container_object_shareable GL_APPLE_flush_render GL_APPLE_object_purgeable GL_APPLE_rgb_422 GL_APPLE_row_bytes GL_APPLE_texture_range GL_ATI_texture_mirror_once GL_NV_texture_barrier
WebGL 1 Extensions ANGLE_instanced_arrays EXT_blend_minmax EXT_color_buffer_half_float EXT_float_blend EXT_frag_depth EXT_shader_texture_lod EXT_sRGB EXT_texture_compression_rgtc EXT_texture_filter_anisotropic MOZ_debug OES_element_index_uint OES_fbo_render_mipmap OES_standard_derivatives OES_texture_float OES_texture_float_linear OES_texture_half_float OES_texture_half_float_linear OES_vertex_array_object WEBGL_color_buffer_float WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL_depth_texture WEBGL_draw_buffers WEBGL_lose_context
WebGL 2 Driver WSI Info CGL
IsWebglOutOfProcessEnabled: 0
WebGL 2 Driver Renderer Intel Inc. -- Intel(R) UHD Graphics 630
WebGL 2 Driver Version 4.1 INTEL-14.7.11
WebGL 2 Driver Extensions GL_ARB_blend_func_extended GL_ARB_draw_buffers_blend GL_ARB_draw_indirect GL_ARB_ES2_compatibility GL_ARB_explicit_attrib_location GL_ARB_gpu_shader_fp64 GL_ARB_gpu_shader5 GL_ARB_instanced_arrays GL_ARB_internalformat_query GL_ARB_occlusion_query2 GL_ARB_sample_shading GL_ARB_sampler_objects GL_ARB_separate_shader_objects GL_ARB_shader_bit_encoding GL_ARB_shader_subroutine GL_ARB_shading_language_include GL_ARB_tessellation_shader GL_ARB_texture_buffer_object_rgb32 GL_ARB_texture_cube_map_array GL_ARB_texture_gather GL_ARB_texture_query_lod GL_ARB_texture_rgb10_a2ui GL_ARB_texture_storage GL_ARB_texture_swizzle GL_ARB_timer_query GL_ARB_transform_feedback2 GL_ARB_transform_feedback3 GL_ARB_vertex_attrib_64bit GL_ARB_vertex_type_2_10_10_10_rev GL_ARB_viewport_array GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_framebuffer_multisample_blit_scaled GL_EXT_texture_compression_s3tc GL_EXT_texture_filter_anisotropic GL_EXT_texture_sRGB_decode GL_APPLE_client_storage GL_APPLE_container_object_shareable GL_APPLE_flush_render GL_APPLE_object_purgeable GL_APPLE_rgb_422 GL_APPLE_row_bytes GL_APPLE_texture_range GL_ATI_texture_mirror_once GL_NV_texture_barrier
WebGL 2 Extensions EXT_color_buffer_float EXT_float_blend EXT_texture_compression_rgtc EXT_texture_filter_anisotropic MOZ_debug OES_texture_float_linear WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL_lose_context
Uses Tiling true
Uses Tiling (Content) true
Off Main Thread Painting Enabled true
Off Main Thread Painting Worker Count 3
Target Frame Rate 60
GPU #1
Active Yes
Vendor ID 0x8086
Device ID 0x3e9b
RAM 0
Diagnostics
AzureCanvasBackend skia
AzureContentBackend skia
AzureFallbackCanvasBackend none
CMSOutputProfile AAANTGFwcGwCEAAAbW50clJHQiBYWVogB+QACwADABcAAgAGYWNzcEFQUEwAAAAAQVBQTAAAAAAAAAAAAAAAAAAAAAAAAPbWAAEAAAAA0y1hcHBsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASZGVzYwAAAVwAAABiZHNjbQAAAcAAAAHuY3BydAAAA7AAAAAjd3RwdAAAA9QAAAAUclhZWgAAA+gAAAAUZ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TileHeight 512
TileWidth 512
Decision Log
HW_COMPOSITING
available by default
OPENGL_COMPOSITING
available by default
WEBRENDER
available by default
WEBRENDER_QUALIFIED
available by default
WEBRENDER_COMPOSITOR
available by default
WEBRENDER_ANGLE
available by default
unavailable by env: OS not supported
WEBRENDER_DCOMP_PRESENT
available by default
disabled by user: User disabled via pref
unavailable by env: Requires Windows 10 or later
unavailable by runtime: Requires ANGLE
WEBRENDER_SOFTWARE
available by default
disabled by env: Overriden by qualified hardware
OMTP
available by default
WEBGPU
disabled by default: Disabled by default
blocked by runtime: WebGPU can only be enabled in nightly
Failure Log
(#0) Error DataSourceSurface of SharedSurfaces does not exist for extId:8589938786
(#41) Error DataSourceSurface of SharedSurfaces does not exist for extId:8590011602
(#42) Error DataSourceSurface of SharedSurfaces does not exist for extId:8590011603
(#43) Error DataSourceSurface of SharedSurfaces does not exist for extId:8590013974
(#44) Error DataSourceSurface of SharedSurfaces does not exist for extId:8590013975
(#45) Error DataSourceSurface of SharedSurfaces does not exist for extId:8590014764
(#46) Error DataSourceSurface of SharedSurfaces does not exist for extId:8590014764
(#47) Error DataSourceSurface of SharedSurfaces does not exist for extId:8590016206
(#48) Error DataSourceSurface of SharedSurfaces does not exist for extId:8590017163
(#49) Error DataSourceSurface of SharedSurfaces does not exist for extId:8590017163
(#50) Error DataSourceSurface of SharedSurfaces does not exist for extId:8590017248
(#51) Error DataSourceSurface of SharedSurfaces does not exist for extId:8590017249
(#52) Error DataSourceSurface of SharedSurfaces does not exist for extId:8590017563
(#53) Error DataSourceSurface of SharedSurfaces does not exist for extId:8590017569
(#54) CP+[GFX1-]: Managed to allocate after flush.
(#55) CP+[GFX1-]: Managed to allocate after flush.
| Reporter | ||
Comment 14•5 years ago
|
||
Markus, I mentioned above that there's a discrepancy between what Firefox reports as its memory usage (was 2.4GB, now 3.4GB) and the total memory impact on the system when Firefox is running.
Four highest memory consumers after firefox are the plugin-container processes which take up 1.5GB each and they continue to grow. Since plugin-container is related to, and used by, Firefox, one can't simply look at the reported memory usage of the firefox process itself (3.4GB) and think that things are ok.
I'm now down to less than 3GB of memory out of 64GB. No other major apps running besides Firefox. Firefox itself reports 3.4GB but Mac's Activity Monitor says memory used is 45GB. Cached files 20GB.
PhysMem: 61G used (7684M wired), 3015M unused.
It is still horrendous that with only Firefox running my memory is almost totally maxed out. I will repeat my claim above, that whatever the available memory on a system is, the Firefox app for Mac will effectively end up filling all of that memory, and then force my machine to start swapping.
When firefox fills up my memory and I will be forced to kill it I'm 100% convinced that the memory usage will drop down to less than 6GB (OS).
Comment 15•5 years ago
|
||
(In reply to Adam from comment #14)
Firefox itself reports 3.4GB but Mac's Activity Monitor says memory used is 45GB.
Oh, that part wasn't clear to me from your initial report. So Activity Monitor indeed shows that the Firefox parent process specifically is using a lot more memory than it thinks it's using.
Then it does indeed sound like that same bug.
| Reporter | ||
Comment 16•5 years ago
|
||
Please make sure that this is fixed, it's been a frustrating bug to deal with for years now. I shouldn't have to see firefox devour my desktop memory especially after an upgrade to 64GB.
Comment 17•5 years ago
|
||
Actually, could you clarify what Activity Monitor says about the process? Does it only say 45GB used overall, or does it say 45GB used by one particular Firefox process?
In bug 1691136, Activity Monitor displayed 60GB+ for one specific Firefox process.
| Reporter | ||
Comment 18•5 years ago
|
||
Sure. Relevant info from Activity Monitor for the Firefox process:
Memory 3.4GB
Threads 97
Ports 199745
In general section below:
Physical memory 64 GB
Memory used: 45.13 GB < App Memory: 37.63 GB
Wired Memory: 7.50 GB
Compressed: 2.9 MB
Cached Files: 18.73 GB
| Reporter | ||
Comment 19•5 years ago
|
||
% top -o mem
Processes: 444 total, 2 running, 442 sleeping, 1960 threads 13:20:59
MemRegions: 101826 total, 4993M resident, 259M private, 5546M shared.
PhysMem: 61G used (7664M wired), 2638M unused.
VM: 2831G vsize, 1991M framework vsize, 0(0) swapins, 0(0) swapouts.
PID COMMAND %CPU TIME #TH #WQ #PORTS MEM PURG CMPRS
1274 firefox 8.5 51:09:17 97 1 199792 3519M 373M 0B
1279 plugin-conta 1.7 10:20:15 38 1 21946 1697M 0B 0B
1281 plugin-conta 0.5 09:53:08 37 1 6655 1587M 0B 0B
6332 plugin-conta 0.4 06:28:00 39 1 4988 1512M 0B 0B
1298 plugin-conta 0.8 08:21:04 39 1 4428 1418M+ 0B 0B
1566 plugin-conta 4.2 18:35:53 42 1 5500 1336M+ 0B 0B
1303 plugin-conta 0.5 10:14:06 40 1 5145 1102M+ 0B 0B
1297 plugin-conta 0.5 05:57:27 39 1 4016 1080M 0B 0B
1304 plugin-conta 0.5 09:34:32 37 1 4158 1054M+ 0B 0B
31976 com.apple.We 0.0 36:18.84 7 1 219 1005M 19M 0B
4042 com.apple.We 0.0 33:57.66 13 2 300 743M 0B 0B
17579 com.apple.We 0.0 26:34.21 7 1 206 433M 2748K 0B
1277 plugin-conta 0.1 55:03.53 28 1 21447 429M 0B 0B
Comment 20•5 years ago
|
||
Thank you. So Activity Monitor does not show 10GB+ for an individual Firefox process. Rather, it is the accumulation of many processes that ends up with the large value.
However, looking at the output from top, the processes displayed in the list still only sum up to about 17GB of memory. That's still a long way from the 37GB of app memory. (I know the list is incomplete, but you'd need about 47 more processes with 420MB of memory to make up the remaining 20GB, and I'm guessing that's not the case here.)
So there's still a piece of the puzzle we're missing.
Is there any of the "memory" columns in Activity Monitor which does sum up to the 37GB of app memory? If so, which column is it and what are the values for the various Firefox processes?
I am currently trying to figure out how we can get information about what causes the large number of ports.
Also, could you check whether this reproduces in a fresh Firefox profile, on Firefox Nightly, without any add-ons?
Comment 21•5 years ago
|
||
Also, could you run the following command and attach the output here? sudo lsmp -p 1274 > firefox_ports.txt (replacing 1274 with the pid of the firefox process that has the large number of ports)
| Reporter | ||
Comment 22•5 years ago
|
||
Keep in mind that there are a total of 11 plugin-container processes running, more than what is listed in the top -o mem output above (limited by the standard 24 lines of output); the output above only captures the biggest offenders (granted they are in descending order so they are progressively smaller in size).
The command you've asked me to run ran into an issue:
% ps -ef | grep firefox
501 1274 1 0 30Jan21 ?? 3085:16.81 /Applications/Firefox.app/Contents/MacOS/firefox
501 70934 13460 0 3:03PM ttys001 0:00.00 grep firefox
% sudo lsmp -p 1274 > ~/firefox_ports.txt
mach_port_space_info() failed: pid:1274 error: (os/kern) resource shortage
Failed to find task ipc information for pid 1274
Ignoring failure of mach_port_space_info() for task 70403 for '-all'
I will be able to try to reproduce this leak with another profile or build per your request above after I'm done with the tabs that I have now open (or firefox consumes all of available memory, whichever comes first) - I have some unsaved work in them - only then I can quit it or kill it and try another configuration. With the small leak we're looking at I imagine it will take a few weeks to see the memory consumption ramp up to the high levels it is at now so the answer to that one won't be immediate.
Comment 23•5 years ago
|
||
mach_port_space_info() failed: pid:1274 error: (os/kern) resource shortage
Oh wow.
Oh, and the current Firefox session has been running since Jan 30th, so for about four and a half weeks? Maybe that's why we haven't gotten more reports of this problem. In those four weeks I've had to restart my Firefox a lot of times, due to OS updates and Firefox updates.
By the way, in Firefox 86 we have fixed a number of leaks (see bug 1683879) so the ports leak may already be fixed.
| Reporter | ||
Comment 24•5 years ago
|
||
(In reply to Markus Stange [:mstange] from comment #23)
mach_port_space_info() failed: pid:1274 error: (os/kern) resource shortageOh wow.
:-)
Oh, and the current Firefox session has been running since Jan 30th, so for about four and a half weeks? Maybe that's why we haven't gotten more reports of this problem. In those four weeks I've had to restart my Firefox a lot of times, due to OS updates and Firefox updates.
Yes, but I think you'll agree that this is not a fringe system/application usage. Some tabs have been kept open because they contain information that I need to frequently refer back to and the amount of system memory certainly allows for holding their contents. Some of the tabs (like online mail) are refreshed as time goes by but in general a system in equilibrium should stay in equilibrium. As a fellow computer scientist I'm sure you and I are in agreement that browser and system restarts are not a fix for a memory leak issue, it's just a statement of fact that you and I have a different web browser user behavior.
By the way, in Firefox 86 we have fixed a number of leaks (see bug 1683879) so the ports leak may already be fixed.
I can test that when I'm able to part with the tabs that I have currently open and spend more time on troubleshooting this but I won't to speculate at this point. I am currently at PhysMem: 62G used (7729M wired), 2069M unused (-1GB available over a period of less than 12 hours) and I barely opened any new tabs today.
Hopefully this issue can be nailed down soon.
Updated•5 years ago
|
Comment 25•5 years ago
|
||
I've been reading the discussion at https://developer.apple.com/forums/thread/110688 for some background. https://robert.sesek.com/2012/1/debugging_mach_ports.html is also rather illuminating.
Comment 26•5 years ago
|
||
Adam, which add-ons do you have installed? Mabye one of these is using native messaging with another app on your system and leaks open ports.
| Reporter | ||
Comment 27•5 years ago
|
||
Henrik: only NoScript v11.2.3 is installed, "Recommended" by the Firefox staff.
| Reporter | ||
Comment 28•5 years ago
|
||
BTW after firefox ran my memory down to the ground over the weekend I had to quit it and after that it updated to 86.0. I also restarted the system fully at that point.
Now in 86.0 the memory hogging is even worse, after less than a handful of days I'm already at PhysMem: 31G used (4195M wired), 33G unused and the Firefox process is 1.7GB in size already.
| Reporter | ||
Comment 29•5 years ago
|
||
firefox process: 1.71 GB, 100 threads, 3940 ports
Comment 30•5 years ago
|
||
Adam, given that you have such massive problems maybe you would be interested to install an early release of my PerfChaser extension:
https://github.com/whimboo/perfchaser
It would help you to observe CPU load and memory usage because it's always visible in the sidebar. Maybe you can figure out which specific action or website cause the increase of Firefox' memory. When it increases it would be also good to know what about:memory reports for heap-unclassified for that particular process.
| Reporter | ||
Comment 31•5 years ago
|
||
Massive is the key word. Firefox 86 is now at 2.59GB of memory usage, 93 threads and 10,900 ports, after a little over a week of running. Not that many tabs open.
What you're suggesting is a very low-tech solution, basically relaying on me, the end user to monitor and manually figure out what website caused your binary to hog memory?
| Reporter | ||
Comment 32•5 years ago
|
||
| Reporter | ||
Comment 33•5 years ago
|
||
What kinds of automated tests do you folks run against system memory (ab)use before a firefox build is released?
Comment 34•5 years ago
|
||
(In reply to Adam from comment #31)
What you're suggesting is a very low-tech solution, basically relaying on me, the end user to monitor and manually figure out what website caused your binary to hog memory?
Adam, please keep in mind that a web browser is not just a simple application that in the best case operates on defined input. Instead millions of websites have to be supported, and handled as best as possible. Each of those can be perfectly written performance wise or not. In a lot of cases issues only show up behind logins, or even require additionally long-term collected data. On the other side also Gecko as rendering engine has bugs that would only manifest when having certain sites open.
That said it's impossible to test all of these combinations, and as such we are indeed dependent on your valuable input. Identifying a specific site that is causing the trouble would allow us to move forward this bug given that could give us a chance to reproduce the problem eventually. And with a fix landed in Firefox in nearly all the cases tests will be added if possible.
Comment 35•5 years ago
|
||
This seems like regular 'high memory usage', which could make sense depending on the site. Do you care about this for Spotlight, Markus?
Comment 36•5 years ago
|
||
I think it's more a case of "there's a leak somewhere and things slowly accumulate over two weeks of uptime". Yes, I care about this from the Mac side, and we're tracking it with the [mac:stability] tag.
Comment 37•5 years ago
|
||
Slow leaks of system resources are something we likely don't have good testing for or awareness of.
| Reporter | ||
Comment 38•5 years ago
|
||
No, an application like firefox hogging the entire 64GB of computer memory is not "regular memory usage".
The leak like the one I'm experiencing really cripples the machine. This bug is a good opportunity to add better coverage for app memory issues.
Comment 39•5 years ago
|
||
Adam, what type of application work do you do on the mini? Do you have lots of fonts installed?
| Reporter | ||
Comment 40•5 years ago
|
||
9 months later, the issue still persists.
At this very moment PhysMem: 54G used (8790M wired), 10G unused. When the mac mini eventually runs out of memory because of the hog, it will become unresponsive on return from sleep and will have to be hard booted (by pressing the power button to power down, then up). Any information in RAM is lost each time. Rinse, repeat.
The mini is used mostly for reading news articles, editing Google Docs and Sheets, web mail and general web browsing, all on Firefox. Some Terminal windows open, but no running processes. No other applications are running in the background.
To answer the fonts question - no new/custom fonts were installed on this machine.
I look forward to the fix.
Updated•4 years ago
|
Comment 41•4 years ago
|
||
:mstange, do we know if this is a MacOS bug or a Firefox bug? Can you help us set the priority of this and provide next steps if they exist?
Comment 42•4 years ago
|
||
It's probably a Firefox bug.
Good question about the next step. It's probably easiest to tackle small scenarios individually and ensure they don't leak. For example, opening and closing a window should be largely port-neutral, once various caches have been filled. I'll file a bug about that.
As for priority, it's hard to say. It's a really bad bug for the people who run into it. But I haven't heard a lot of reports about it.
Going to set P2 for now.
Comment 43•4 years ago
|
||
The port issue is now being looked at in bug 1755701 and dependents.
The primary question remaining is why there's a disparity between Activity Monitor and our internal reporting (though perhaps the ports is part of the issue).
To the reporter, next time memory is getting low (but not in the red zone), try taking a memory report. (or take memory reports every few days, which can help show where any increase in usage is occurring). The most common (by far) cause of memory increase in use over time is sites that leak memory. (Not truly leaked, but memory slowly accumulating in a content process due to a site just allocating more resources in a way that they can't be garbage collected.) Closing all tabs from a site (or reloading them all) typically will resolve this sort of problem.
You can usually see a leaking website by looking at about:processes
Thanks!!
Comment 44•4 years ago
|
||
(In reply to Randell Jesup [:jesup] (needinfo me) from comment #43)
You can usually see a leaking website by looking at about:processes
Or use my experimental extension called PerfChaser which sits in the sidebar and lets you continuously watch the CPU and memory utilization: https://github.com/whimboo/perfchaser/
| Reporter | ||
Comment 45•4 years ago
|
||
To Mr. Jesup:
The issue is huge memory usage that renders the computer unusable and forces a reboot, not a “disagreement between Activity Monitor and internal memory reporting". Please do not change the title to derail from the main issue.
I had provided memory reports above.
Internal memory reporting will always be king, so in addition to a bug that causes a memory leak there may be an issue with internal reporting. Please file a new bug and investigate, don't alter an existing bug (this). Fixing that other issue may give you additional data points for this issue.
Lastly, what you wrote "sites that leak memory" is not a real thing. Sites don't leak memory, a web browser does. This application leaking memory is a real issue. Pls investigate and fix it.
To answer your suggestion “Closing all tabs from a site (or reloading them all) typically will resolve this sort of problem.": closing the application will fix the memory leak too (and that happens when the machine runs of out GB of memory and reboots), but it's not the true solution, is it.
Comment 46•4 years ago
|
||
If a site is leaking memory, we can't fix that - they have to. In JS, you can leak memory by never releasing a pointer to it. I've previously found (for example) anti-clickfraud JS code used by many top sites that was adding strings to an array every N milliseconds. After leaving the site open for hours or a day, it would have leaked 100's of MB or a few GB. There's nothing we can do (other than to close the tab), since the site is using that memory.
In order to do that, someone has to identify which site is leaking. Using PerfChaser or a profile or a memory report can help identify the site.
As mentioned, the port issue is being examined elsewhere. If there is a memory usage issue caused by that, that will be addressed there.
Comment 47•4 years ago
|
||
I'll note that (as discussed) the memory report does not indicate a website leak, but your description of the state of the system memory and the memory report appear to disagree (and thus why I had changed the title). It's possible the memory usage is all in the OS (not application memory) and tied to the ports open; if so it will be resolved in the other bug.
Updated•1 year ago
|
Description
•