Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 474104

Summary: [GTK3] Eclipse causes Xorg to swap large amounts of memory
Product: [Eclipse Project] Platform Reporter: Darcy Beurle <darcy>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: major    
Priority: P3 CC: ericwill, loskutov, mar.kolya
Version: 4.4.2Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Darcy Beurle CLA 2015-08-02 23:50:50 EDT
After a short amount of time Eclipse causes Xorg to consume a large amount of memory, approximately 4-5GB.  This makes the system unusable, especially on a laptop with 4GB of ram.

Eclipse 4.5 does not seem to have this problem.

Using Gnome 3.16, F22.

This has been reported against Xorg but it only happens for Eclipse, see https://bugzilla.redhat.com/show_bug.cgi?id=1218818

Happy to provide more information if required.
Comment 1 Andrey Loskutov CLA 2015-08-03 00:41:31 EDT
Can you please try if Eclipse 4.5 with GTK2 causes same problem as Eclipse 4.4? No one will patch 4.4, but it would be good to know what exactly is the root cause.

Eclipse 4.5 uses GTK3 by default, 4.4 uses GTK2, but you can enforce GTK2 by setting env. variable before starting Eclipse: SWT_GTK3=0
Comment 2 Darcy Beurle CLA 2015-08-03 01:13:59 EDT
(In reply to Andrey Loskutov from comment #1)
> Can you please try if Eclipse 4.5 with GTK2 causes same problem as Eclipse
> 4.4? No one will patch 4.4, but it would be good to know what exactly is the
> root cause.
> 
> Eclipse 4.5 uses GTK3 by default, 4.4 uses GTK2, but you can enforce GTK2 by
> setting env. variable before starting Eclipse: SWT_GTK3=0

Hi Andrey,

Thanks for the quick reply.  I'm using HiDPI screens on 4.4 and it seems to use GTK3 as I get the rough scrolling and the dialog boxes are scaled.  The GTK2 appears tiny on my system.

I'm trying 4.5 now with GTK2.  Should I try 4.4 with GTK2 instead?
Comment 3 Andrey Loskutov CLA 2015-08-03 01:20:32 EDT
(In reply to Darcy Beurle from comment #2)
> I'm using HiDPI screens on 4.4 and it seems to
> use GTK3 as I get the rough scrolling and the dialog boxes are scaled.  The
> GTK2 appears tiny on my system.
> 
> I'm trying 4.5 now with GTK2.  Should I try 4.4 with GTK2 instead?

I'm curious why your 4.4 is running with GTK3? It is "default" from 4.5 only. But yes, in this case you should switch 4.4 to GTK2 too. BTW please check your 4.4 eclipse.ini file - if someone changed the launcher arguments to use gtk2? It's --launcher.GTK_version option.
Comment 4 Darcy Beurle CLA 2015-08-03 01:27:38 EDT
(In reply to Andrey Loskutov from comment #3)
> (In reply to Darcy Beurle from comment #2)
> > I'm using HiDPI screens on 4.4 and it seems to
> > use GTK3 as I get the rough scrolling and the dialog boxes are scaled.  The
> > GTK2 appears tiny on my system.
> > 
> > I'm trying 4.5 now with GTK2.  Should I try 4.4 with GTK2 instead?
> 
> I'm curious why your 4.4 is running with GTK3? It is "default" from 4.5
> only. But yes, in this case you should switch 4.4 to GTK2 too. BTW please
> check your 4.4 eclipse.ini file - if someone changed the launcher arguments
> to use gtk2? It's --launcher.GTK_version option.

Weird.  I have 3 eclipse.ini files locations: (locate eclipse.ini)
/etc/eclipse.ini
~/.eclipse/org.eclipse.platform_793567567_linux_gtk_x86_64/configuration/eclipse.ini.ignored
/usr/lib64/eclipse/eclipse.ini

The first and last say --launcher.GTK_version 3 - maybe this is a packaging addition for F22?

I'll launch 4.4 now with GTK2 and report back.
Comment 5 Darcy Beurle CLA 2015-08-03 01:56:28 EDT
(In reply to Darcy Beurle from comment #4)
> (In reply to Andrey Loskutov from comment #3)
> > (In reply to Darcy Beurle from comment #2)
> > > I'm using HiDPI screens on 4.4 and it seems to
> > > use GTK3 as I get the rough scrolling and the dialog boxes are scaled.  The
> > > GTK2 appears tiny on my system.
> > > 
> > > I'm trying 4.5 now with GTK2.  Should I try 4.4 with GTK2 instead?
> > 
> > I'm curious why your 4.4 is running with GTK3? It is "default" from 4.5
> > only. But yes, in this case you should switch 4.4 to GTK2 too. BTW please
> > check your 4.4 eclipse.ini file - if someone changed the launcher arguments
> > to use gtk2? It's --launcher.GTK_version option.
> 
> Weird.  I have 3 eclipse.ini files locations: (locate eclipse.ini)
> /etc/eclipse.ini
> ~/.eclipse/org.eclipse.platform_793567567_linux_gtk_x86_64/configuration/
> eclipse.ini.ignored
> /usr/lib64/eclipse/eclipse.ini
> 
> The first and last say --launcher.GTK_version 3 - maybe this is a packaging
> addition for F22?
> 
> I'll launch 4.4 now with GTK2 and report back.

Launching with GTK2 stops the swapping on 4.4.
Comment 6 Nikolay Martynov CLA 2018-01-18 22:45:56 EST
The problem seems to still exist with resent Oxygen:

Eclipse Java EE IDE for Web Developers.

Version: Oxygen.2 Release (4.7.2)
Build id: 20171218-0600

OS: Ubuntu 17.10

$ java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.17.10.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

Building Java (for example when I update Maven deps) project consumes about 2GB+ of RAM - and that is never reclaimed back. My eclipse.ini contains this:

-Xms256m
-Xmx1024m

So RSS should be limited close to 1GB - yet single build puts it close to 3GB.

I've also noticed that problem only exists (at least as prominent) when GTK3 is enabled. If I switch to GTK2 there is not much memory consumption growth.
Comment 7 Eric Williams CLA 2018-08-16 14:58:09 EDT

*** This bug has been marked as a duplicate of bug 533995 ***