JDK-8202549 : Javadoc consumes up to 6.5G memory to work
  • Type: Bug
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 8
  • Priority: P4
  • Status: Resolved
  • Resolution: Won't Fix
  • OS: generic
  • CPU: x86_64
  • Submitted: 2018-05-02
  • Updated: 2018-06-05
  • Resolved: 2018-06-05
Related Reports
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
Windows 10, JDK 1.8.161 and JDK 1.8.151, JavaDoc 3.0.0 and JavaDoc 2.9

A DESCRIPTION OF THE PROBLEM :
When preparing deployment of my project https://github.com/Cruisoring/functionExtensions/blob/master/src/main/java/io/github/cruisoring/function/WithValueReturned.java, I got many OutOfMemory errors even turned off DocLint by setting it to "none".

Finally, by adding configuration to javaDoc plugin section as below:
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <maxmemory>8192m</maxmemory>
              <minmemory>1024m</minmemory>
            </configuration>
          </execution>
        </executions>
      </plugin>

The documents were generated and packaged successfully. I can see the peak consumption of the memory by javaDoc process has reached around 6.5G and that might mean something you can improve.

To replicate the issue, please clone the repository from https://github.com/Cruisoring/functionExtensions and run "mvn javadoc:javadoc".

Thanks for your attention.



Comments
Since this is respect to the old doclet, and since it apparently involves source code that references internal API that no longer exists, this is either "Will Not Fix" or "Not Reproducible" (meaning, not reproducible on current versions of javadoc.) It is not surprising that the amount of memory required can depend on the size of the input. It would be interesting to see some overall statistics on the size of the code being presented to javadoc, and to compare that (for example) to the size of JDK when generating docs for that. And yes, in the new doclet, we have replaced one of the primary data structures, which should reduce the overall memory usage.
02-05-2018

I am able to reproduce this issue on JDK8 in Windows and Linux. Javadoc memory consumption has raised once to 5.8GB before it completes its execution. Not able to verify the issue on new doclet, as the test case has dependencies with "sun.reflect.ConstantPool" and "com.sun.media.sound" which are not available in jdk9 and above Below is the mvn build error == [ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.0:javadoc (default-cli) on project functionExtensions: An error has occurred in Javadoc report generation: [ERROR] Exit code: 1 - /scratch/fairoz/JI/9053633/functionExtensions-master/src/main/java/io/github/cruisoring/TypeHelper.java:12: error: cannot find symbol [ERROR] import sun.reflect.ConstantPool; [ERROR] ^ [ERROR] symbol: class ConstantPool [ERROR] location: package sun.reflect [ERROR] /scratch/fairoz/JI/9053633/functionExtensions-master/src/main/java/io/github/cruisoring/TypeHelper.java:488: error: cannot find symbol [ERROR] protected static ConstantPool getConstantPoolOfClass(Class objectClass){ [ERROR] ^ [ERROR] symbol: class ConstantPool [ERROR] location: class TypeHelper [ERROR] /scratch/fairoz/JI/9053633/functionExtensions-master/src/main/java/io/github/cruisoring/utility/StringHelper.java:7: error: package com.sun.media.sound is not visible [ERROR] import com.sun.media.sound.InvalidFormatException; [ERROR] ^ [ERROR] (package com.sun.media.sound is declared in module java.desktop, which does not export it) [ERROR] [ERROR] Command line was: /scratch/fairoz/JAVA/jdk-9.0.4/bin/javadoc @options @packages [ERROR] [ERROR] Refer to the generated Javadoc files in '/scratch/fairoz/JI/9053633/functionExtensions-master/target/site/apidocs' dir. [ERROR] [ERROR] -> [Help 1] [ERROR] ==
02-05-2018