Bug 536850 - Webkit2 and Java processes take up extreme Virtual size upon instantiating browser
Summary: Webkit2 and Java processes take up extreme Virtual size upon instantiating br...
Status: CLOSED NOT_ECLIPSE
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.8   Edit
Hardware: PC Linux
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2018-07-09 12:37 EDT by Twelve Eighty CLA
Modified: 2018-07-10 12:13 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Twelve Eighty CLA 2018-07-09 12:37:44 EDT
Initially, after launching Photon 4.8 on Linux, "top" reports the java process taking up VIRT (virtual size) of 5301m.

However, after hovering the mouse over a class to spawn the Webkit2 browser for Javadoc, "top" reports:

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                           
 5530 twelvee+  20   0  102.4g 703.5m  74.5m S   1.7   4.4   1:28.76 java                                              
 5766 twelvee+  20   0  114.0g  72.5m  60.0m S   0.0   0.5   0:00.37 WebKitWebProces                                   
 5768 twelvee+  20   0   98.0g  43.9m  30.9m S   0.0   0.3   0:00.16 WebKitNetworkPr                                   

This is a jump to 102.4g! I understand that virtual size isn't actual memory usage, but isn't this an insanely high value? The two webkit processes also report a very high value each.

Running with "export SWT_LIB_VERSIONS=1" reports:

SWT_LIB_Gtk:3.22.30 (Dynamic gdbus)
SWT_LIB GDbus firing up. Implementation v1.5

After the browser window spawns, the following is logged:

SWT_LIB  Webkit2   Webkitgtk:2.20.3  (webkitgtk >=2.5 is Webkit2)  SWT Glue code version: 54.0 info: +BrowserFunction/GDBus, +WebkitExtension Folder versioning, +WebKitExtension OSGI support, +setUrl(..postData..), -setCookie(), -getCookie +mouseDown/Focus

I launch eclipse with the standard eclipse.ini, against JDK 10. Let me know if more info is required.

Is there a way to turn off the Webkit2 browser altogether but still use GTK3? Or does that require me to switch to GTK2?
Comment 1 Eric Williams CLA 2018-07-10 10:28:40 EDT
I believe this is just the way Webkit works. If you launch Epiphany (which uses Webkit), you'll see that the virtual memory size is similar, around 98G.

Virtual memory isn't really an important metric though, as it includes all sorts of things like shared libraries, swap area, etc. A more important metric would be RSS - resident set size, which is reported in the "RES" column of top/htop. If this starts getting unnecessarily large or grows over time, then there might be a leak somewhere.

If you want to investigate further you can take a look using smem, which will give you the proportional set size (PSS), among other things: https://www.selenic.com/smem/
Comment 2 Twelve Eighty CLA 2018-07-10 12:01:17 EDT
Alright, I understand the "not Eclipse issue" designation. I was comparing this to e.g. Firefox, which only reports around 4 GB of Virtual size, hence my concern. Eclipse is the only app using Webkit for me, so I had no other comparable.

Maybe I'm just too much old-school and shouldn't worry about Webkit reporting memory resource needs/usage far beyond the total capacity of my hard disk partitions. /s

I'll take a look at "smem".
Comment 3 Eric Williams CLA 2018-07-10 12:13:12 EDT
(In reply to Twelve Eighty from comment #2)
> Alright, I understand the "not Eclipse issue" designation. I was comparing
> this to e.g. Firefox, which only reports around 4 GB of Virtual size, hence
> my concern. Eclipse is the only app using Webkit for me, so I had no other
> comparable.

For firefox is this total? I believe each firefox tab shows up as its own entry in top. On my system each tab is "using" ~2.5GB of virtual memory.


> Maybe I'm just too much old-school and shouldn't worry about Webkit
> reporting memory resource needs/usage far beyond the total capacity of my
> hard disk partitions. /s

This isn't a cause for concern at all -- virtual memory isn't actually in use, it's just "potential". The kernel will kill off any webkit process that tries to actually use 115G of memory long before it gets there. 

You can read more about memory overcommitment and virtual memory here: https://unix.stackexchange.com/questions/258080/downsides-of-processes-with-high-virtual-size-but-low-ram-and-gpu-memory-use/258142#258142