JDK-8062040 : [macosx] huge native memory leak in AWTWindow.m
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7u66
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • CPU: x86
  • Submitted: 2014-10-24
  • Updated: 2014-10-24
  • Resolved: 2014-10-24
Related Reports
Duplicate :  
Relates :  
Description
There is a huge native memory leak in awt code on Mac OS X. This is regression introduced in JDK 7u66 and it looks identical to JDK-8041572. The leak can be easily reproduced using SwingSet2 with the following steps: 
1) Run SwingSet2 demo on JDK 7u66 
2) move mouse over the SwingSet2 window - for example make circles over the window 

The leak can be seen Activity Monitor and in details in vmmap output. The following output is captured, while moving mouse over SwingSet2 window. 
thurka$ jdk1.7.0_66.jdk/Contents/Home/bin/java -version
java version "1.7.0_66"
Java(TM) SE Runtime Environment (build 1.7.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.66-b02, mixed mode)
thurka$ jdk1.7.0_66.jdk/Contents/Home/bin/java -jar /Library/Java/Demos/JFC/SwingSet2/SwingSet2.jar &
[1] 51865
thurka$ date; vmmap 51865 | grep ^DefaultMallocZone
Fri Oct 24 13:01:17 CEST 2014
DefaultMallocZone_0x102308000      47.8M      70498      31.6M     65%
thurka$ date; vmmap 51865 | grep ^DefaultMallocZone
Fri Oct 24 13:01:32 CEST 2014
DefaultMallocZone_0x102308000     206.8M    3050186     186.2M     90%
thurka$ date; vmmap 51865 | grep ^DefaultMallocZone
Fri Oct 24 13:02:02 CEST 2014
DefaultMallocZone_0x102308000     696.8M   12200965     660.7M     94%
thurka$ date; vmmap 51865 | grep ^DefaultMallocZone
Fri Oct 24 13:02:34 CEST 2014
DefaultMallocZone_0x102308000       1.1G   20383965       1.1G     95%
thurka$ 

As you can see DefaultMallocZone of SwingSet2 application raised to 1.1G in two minutes. 
Comments
Backporting JDK-8041772 (and probably related fix for JDK-8041987) to JDK 7, should fix this issue.
24-10-2014

screenshot showing allocation stack trace of leaked objects.
24-10-2014

8u and 9 are already fixed (AFAICT). This memory leak was not reproducible in JDK 7 at the time it was filed against JDK 8u and JDK 9, but it looks like some backports to JDK 7u66 enabled this issue in JDK 7u66.
24-10-2014