Relates :
|
FULL PRODUCT VERSION : Java(TM) SE Runtime Environment-Java HotSpot(TM) Client VM 1.6.0_05-b13 -- 10.0-b19 1.6.0_02-b05 -- 1.6.0_02-b05 FULL OS VERSION : OS Name Microsoft Windows XP Professional Version 5.1.2600 Service Pack 2 Build 2600 OS Manufacturer Microsoft Corporation OS Name Microsoft(R) Windows(R) Server 2003, Enterprise Edition Version 5.2.3790 Service Pack 2 Build 3790 Other OS Description Not Available OS Manufacturer Microsoft Corporation EXTRA RELEVANT SYSTEM CONFIGURATION : System Manufacturer Dell Computer Corporation System Model Latitude D800 System Type X86-based PC Processor x86 Family 6 Model 13 Stepping 6 GenuineIntel ~1993 Mhz BIOS Version/Date Dell Computer Corporation A11, 9/3/2004 SMBIOS Version 2.3 Windows Directory C:\WINDOWS System Directory C:\WINDOWS\system32 Boot Device \Device\HarddiskVolume1 Locale United States Hardware Abstraction Layer Version = "5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)" User Name AMER\cstodden Time Zone Mountain Daylight Time Total Physical Memory 2,048.00 MB Available Physical Memory 1,018.61 MB Total Virtual Memory 2.00 GB Available Virtual Memory 1.96 GB Page File Space 3.35 GB Page File C:\pagefile.sys System Manufacturer Dell Computer Corporation System Model PowerEdge 650 System Type X86-based PC Processor x86 Family 15 Model 2 Stepping 7 GenuineIntel ~3066 Mhz Processor x86 Family 15 Model 2 Stepping 7 GenuineIntel ~3066 Mhz BIOS Version/Date Dell Computer Corporation A05, 10/14/2004 SMBIOS Version 2.3 Windows Directory C:\WINDOWS System Directory C:\WINDOWS\system32 Boot Device \Device\HarddiskVolume1 Locale United States Hardware Abstraction Layer Version = "5.2.3790.3959 (srv03_sp2_rtm.070216-1710)" Time Zone Mountain Daylight Time Total Physical Memory 2,047.39 MB Available Physical Memory 1.47 GB Total Virtual Memory 3.85 GB Available Virtual Memory 3.27 GB Page File Space 2.00 GB Page File C:\pagefile.sys A DESCRIPTION OF THE PROBLEM : Occurs while performing compile operations and annotation processing within the Eclipse IDE plugin framework. Repetitive creation of the UrlClassLoader given a large classpath and subsequent calls to URLClassLoader.loadClass results in the following: # # An unexpected error has been detected by Java Runtime Environment: # # java.lang.OutOfMemoryError: requested 75912 bytes for Chunk::new. Out of swap space? # # Internal Error (allocation.cpp:218), pid=3908, tid=3912 # Error: Chunk::new # THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Given the subsequent source code snippet: 1. Gather a sizeable number of jar files and place them into a know directory location. 2. Specify a few class files to be resolved by the UrlClassLoader.loadclass call. 3. Compile and run the program specify -DlibDir="path to jars" Monitor the heap, perm, etc. Launch Task Manager and monitor the mem usage here. EXPECTED VERSUS ACTUAL BEHAVIOR : I would expect that the URLClassLoader free memory when no longer referenced. Thus allowing native memory to be freed. I would expect the loadClass call to be memory bound, in other words a finite number of classes can be loaded. ERROR MESSAGES/STACK TRACES THAT OCCUR : Sample Program Exception: Exception in thread "main" java.lang.OutOfMemoryError at java.util.zip.Inflater.init(Native Method) at java.util.zip.Inflater.<init>(Inflater.java:81) at java.util.zip.ZipFile.getInflater(ZipFile.java:267) at java.util.zip.ZipFile.getInputStream(ZipFile.java:212) at java.util.zip.ZipFile.getInputStream(ZipFile.java:180) at java.util.jar.JarFile.hasClassPathAttribute(JarFile.java:463) at java.util.jar.JavaUtilJarAccessImpl.jarFileHasClassPathAttribute(JavaUtilJarAccessImpl.java:15) at sun.misc.URLClassPath$JarLoader.getClassPath(URLClassPath.java:899) at sun.misc.URLClassPath.getLoader(URLClassPath.java:300) at sun.misc.URLClassPath.getResource(URLClassPath.java:167) at java.net.URLClassLoader$1.run(URLClassLoader.java:192) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at oom.OOMUrlClassPath.main(OOMUrlClassPath.java:29) hs_pid_err.log: # # An unexpected error has been detected by Java Runtime Environment: # # java.lang.OutOfMemoryError: requested 32756 bytes for ChunkPool::allocate. Out of swap space? # # Internal Error (allocation.cpp:120), pid=1360, tid=3336 # Error: ChunkPool::allocate # # Java VM: Java HotSpot(TM) Client VM (10.0-b19 mixed mode windows-x86) # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # --------------- T H R E A D --------------- Current thread (0x42dca800): JavaThread "CompilerThread0" daemon [_thread_in_native, id=3336, stack(0x43060000,0x430b0000)] Stack: [0x43060000,0x430b0000] [error occurred during error reporting (printing stack bounds), id 0x80000001] Current CompileTask: C1:596 javax.management.openmbean.CompositeDataSupport.<init>(Ljavax/management/openmbean/CompositeType;[Ljava/lang/String;[Ljava/lang/Object;)V (362 bytes) --------------- P R O C E S S --------------- Java Threads: ( => current thread ) 0x4efa6400 JavaThread "RMI TCP Connection(4)-127.0.0.1" daemon [_thread_blocked, id=3212, stack(0x53220000,0x53260000)] 0x4efa5c00 JavaThread "RMI TCP Connection(idle)" daemon [_thread_blocked, id=2424, stack(0x531e0000,0x53220000)] 0x4eb5d400 JavaThread "RMI TCP Connection(idle)" daemon [_thread_blocked, id=3920, stack(0x531a0000,0x531e0000)] 0x43336400 JavaThread "JMX server connection timeout 15" daemon [_thread_blocked, id=3856, stack(0x45150000,0x45190000)] 0x42d3ac00 JavaThread "RMI Scheduler(0)" daemon [_thread_blocked, id=2664, stack(0x45110000,0x45150000)] 0x442f3c00 JavaThread "RMI TCP Connection(1)-127.0.0.1" daemon [_thread_in_native, id=1064, stack(0x450c0000,0x45100000)] 0x44239800 JavaThread "RMI TCP Accept-0" daemon [_thread_in_native, id=2012, stack(0x43370000,0x433b0000)] 0x42dda800 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=3160, stack(0x430b0000,0x430f0000)] =>0x42dca800 JavaThread "CompilerThread0" daemon [_thread_in_native, id=3336, stack(0x43060000,0x430b0000)] 0x42db8000 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=1468, stack(0x43020000,0x43060000)] 0x42db6c00 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=2732, stack(0x42fe0000,0x43020000)] 0x42db4c00 JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_blocked, id=3852, stack(0x42fa0000,0x42fe0000)] 0x42daa000 JavaThread "Attach Listener" daemon [_thread_blocked, id=3696, stack(0x42f30000,0x42f70000)] 0x42da9000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=520, stack(0x42ef0000,0x42f30000)] 0x42d99c00 JavaThread "Finalizer" daemon [_thread_blocked, id=3228, stack(0x42eb0000,0x42ef0000)] 0x42d95800 JavaThread "Reference Handler" daemon [_thread_blocked, id=2348, stack(0x42e70000,0x42eb0000)] 0x00386800 JavaThread "main" [_thread_blocked, id=3968, stack(0x003a0000,0x003e0000)] Other Threads: 0x42d92800 VMThread [stack: 0x42e20000,0x42e70000] [id=3112] 0x42df4c00 WatcherThread [stack: 0x430f0000,0x43140000] [id=2364] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap def new generation total 88512K, used 79093K [0x02950000, 0x08950000, 0x0e950000) eden space 78720K, 92% used [0x02950000, 0x070ab6d0, 0x07630000) from space 9792K, 61% used [0x07630000, 0x07c11d98, 0x07fc0000) to space 9792K, 0% used [0x07fc0000, 0x07fc0000, 0x08950000) tenured generation total 294912K, used 40917K [0x0e950000, 0x20950000, 0x32950000) the space 294912K, 13% used [0x0e950000, 0x11145730, 0x11145800, 0x20950000) compacting perm gen total 196608K, used 20233K [0x32950000, 0x3e950000, 0x42950000) the space 196608K, 10% used [0x32950000, 0x33d125c0, 0x33d12600, 0x3e950000) No shared spaces configured. Dynamic libraries: 0x00400000 - 0x00423000 D:\perf\dev\src\build\jdk6_05\bin\javaw.exe 0x7c900000 - 0x7c9b0000 C:\WINDOWS\system32\ntdll.dll 0x7c800000 - 0x7c8f5000 C:\WINDOWS\system32\kernel32.dll 0x77dd0000 - 0x77e6b000 C:\WINDOWS\system32\ADVAPI32.dll 0x77e70000 - 0x77f02000 C:\WINDOWS\system32\RPCRT4.dll 0x77fe0000 - 0x77ff1000 C:\WINDOWS\system32\Secur32.dll 0x7e410000 - 0x7e4a0000 C:\WINDOWS\system32\USER32.dll 0x77f10000 - 0x77f57000 C:\WINDOWS\system32\GDI32.dll 0x7c340000 - 0x7c396000 D:\perf\dev\src\build\jdk6_05\jre\bin\msvcr71.dll 0x6d870000 - 0x6dac0000 D:\perf\dev\src\build\jdk6_05\jre\bin\client\jvm.dll 0x76b40000 - 0x76b6d000 C:\WINDOWS\system32\WINMM.dll 0x6d320000 - 0x6d328000 D:\perf\dev\src\build\jdk6_05\jre\bin\hpi.dll 0x76bf0000 - 0x76bfb000 C:\WINDOWS\system32\PSAPI.DLL 0x6d410000 - 0x6d439000 D:\perf\dev\src\build\jdk6_05\jre\bin\jdwp.dll 0x6d770000 - 0x6d776000 D:\perf\dev\src\build\jdk6_05\jre\bin\npt.dll 0x6d820000 - 0x6d82c000 D:\perf\dev\src\build\jdk6_05\jre\bin\verify.dll 0x6d3c0000 - 0x6d3df000 D:\perf\dev\src\build\jdk6_05\jre\bin\java.dll 0x6d860000 - 0x6d86f000 D:\perf\dev\src\build\jdk6_05\jre\bin\zip.dll 0x6d290000 - 0x6d297000 D:\perf\dev\src\build\jdk6_05\jre\bin\dt_socket.dll 0x71ab0000 - 0x71ac7000 C:\WINDOWS\system32\WS2_32.dll 0x77c10000 - 0x77c68000 C:\WINDOWS\system32\msvcrt.dll 0x71aa0000 - 0x71aa8000 C:\WINDOWS\system32\WS2HELP.dll 0x71a50000 - 0x71a8f000 C:\WINDOWS\System32\mswsock.dll 0x76f20000 - 0x76f47000 C:\WINDOWS\system32\DNSAPI.dll 0x76d60000 - 0x76d79000 C:\WINDOWS\system32\iphlpapi.dll 0x76fb0000 - 0x76fb8000 C:\WINDOWS\System32\winrnr.dll 0x76f60000 - 0x76f8c000 C:\WINDOWS\system32\WLDAP32.dll 0x751d0000 - 0x751ee000 C:\WINDOWS\system32\wshbth.dll 0x77920000 - 0x77a13000 C:\WINDOWS\system32\SETUPAPI.dll 0x76fc0000 - 0x76fc6000 C:\WINDOWS\system32\rasadhlp.dll 0x662b0000 - 0x66308000 C:\WINDOWS\system32\hnetcfg.dll 0x71a90000 - 0x71a98000 C:\WINDOWS\System32\wshtcpip.dll 0x6d360000 - 0x6d37a000 D:\perf\dev\src\build\jdk6_05\jre\bin\instrument.dll 0x6d620000 - 0x6d633000 D:\perf\dev\src\build\jdk6_05\jre\bin\net.dll 0x6d570000 - 0x6d579000 D:\perf\dev\src\build\jdk6_05\jre\bin\management.dll 0x43340000 - 0x43368000 C:\WINDOWS\system32\rsaenh.dll 0x769c0000 - 0x76a73000 C:\WINDOWS\system32\USERENV.dll 0x5b860000 - 0x5b8b4000 C:\WINDOWS\system32\netapi32.dll 0x6d7c0000 - 0x6d7c6000 D:\perf\dev\src\build\jdk6_05\jre\bin\rmi.dll VM Arguments: jvm_args: -ea -Xms384m -Xmx768m -XX:MaxPermSize=256m -XX:PermSize=192m -XX:NewRatio=3 -Xss256k -DprodMode=dev -Dsun.lang.ClassLoader.allowArraySyntax=true -Dosgi.install.area=D:\perf\src_16005jr\bea\tools\eclipse_pkgs\2.0\eclipse_3.3.1\eclipse-test -Dweblogic.home=D:/perf/src_16005jr/bea/buildout/workshopTestServers/wlserver_10.0 -DWEBLOGIC_HOME_10.0=D:\perf\src_16005jr\bea\buildout/workshopTestServers/wlserver_10.0 -DWEBLOGIC_HOME_10.3=D:\perf\src_16005jr\bea\wlserver_10.3 -DWEBLOGIC_HOME_9.2=D:\perf\src_16005jr\bea\buildout/workshopTestServers/weblogic92 -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:1069 java_command: oom.OOMUrlClassPath Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=D:\wlw\external\jdk1.5.0_11 CLASSPATH=.;C:\tools\Java\jre1.5.0_07\lib\ext\QTJava.zip PATH=D:\perf\dev\src\build\jdk6_05\jre\bin;C:\Python22\.;D:\Perl\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\Common Files\Roxio Shared\DLLShared;C:\Program Files\Perforce;C:\Program Files\Subversion\bin;D:\wlw\external\jdk1.5.0_11\bin;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\cygwin\bin;C:\chris\dosCommand;C:\Program Files\Mercury Interactive\LoadRunner\bin;D:\wlw\external\apache-ant-1.6.2\bin;C:\Program Files\psTools;D:\Oracle\product\10.1.0\Client_1;C:\Program Files\Common Files\Microsoft Shared\MSInfo;C:\Program Files\jprofiler3\bin\windows;C:\Program Files\QuickTime\QTSystem\;D:\perf\Fornax\JGearEclipse\eclipse\optimizeit-agent\bin;c:\vslick\win USERNAME=cstodden OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 6 Model 13 Stepping 6, GenuineIntel --------------- S Y S T E M --------------- OS: Windows XP Build 2600 Service Pack 2 CPU:total 1 (1 cores per cpu, 1 threads per core) family 6 model 13 stepping 6, cmov, cx8, fxsr, mmx, sse, sse2 Memory: 4k page, physical 2096360k(70472k free), swap 3514752k(856088k free) vm_info: Java HotSpot(TM) Client VM (10.0-b19) for windows-x86 JRE (1.6.0_05-b13), built on Feb 22 2008 01:16:53 by "java_re" with MS VC++ 7.1 time: Wed May 14 18:49:25 2008 elapsed time: 103 seconds REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- package oom; import java.io.File; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import sun.misc.Resource; import sun.misc.URLClassPath; public class OOMUrlClassPath { /** * @param args */ public static void main(String[] args) { ArrayList<URL> list = projLibs(); for (int j = 0; j < 10000; j++) { URLClassLoader urlClassLoader = new URLClassLoader(list.toArray(new URL[list.size()])); for (int i = 0; i < 1000; i++) { int mod = i % 3; try { if (mod == 0) { urlClassLoader.loadClass("com.sun.org.apache.xalan.internal.extensions.ExpressionContext"); } else if (mod == 1) { urlClassLoader.loadClass("com.bea.control.ServiceControlChecker"); } urlClassLoader.loadClass("com.bea.control.ServiceControl"); } } catch (ClassNotFoundException e) { e.printStackTrace(); } } } } /** * Specify the absolute path to the lib directory ie: D:\\perf\\Electra\\electraDevWorkspace\\OOMProject\\lib * @return */ public static ArrayList projLibs() { String libDir = System.getProperty("libDir"); File classpathJarDir = new File(libDir); ArrayList<URL> list = new ArrayList<URL>(); for (File jarFile : classpathJarDir.listFiles()) { try { list.add(jarFile.toURL()); } catch (MalformedURLException e) { e.printStackTrace(); } } return list; } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : None found