The CDS shared archive contains many methods that are infrequently used, and many of them are never referenced by typical applications. The ratio of unreferenced methods could be very high (as much as 70%) when we create a custom CDS archive (using the -XX:SharedArchiveFile option) for a specific application.
We can reduce memory footprint by splitting the methods between referenced and unreferenced so that we minimize the number of pages which are memory mapped in from the archive.
The proposal is:
+ When creating a custom CDS archive, the customer would first do a "trial run" of the application. In the trial run, specify the -XX:+LogTouchedMethods flag (introduced byJDK-8025692) .
+ Use "jcmd VM.print_touched_methods" to connect to the application and save the list of referenced methods into a text file touched_methods.txt
+ Next, invoke java -Xshare:dump to dump the shared archive. The contents of touched_methods.txt will be used to reorder the shared archive to segregate the unreferenced methods into a separate section.
The command-line option to pass touched_methods.txt to "java -Xshare:dump" is TBD.
We can reduce memory footprint by splitting the methods between referenced and unreferenced so that we minimize the number of pages which are memory mapped in from the archive.
The proposal is:
+ When creating a custom CDS archive, the customer would first do a "trial run" of the application. In the trial run, specify the -XX:+LogTouchedMethods flag (introduced by
+ Use "jcmd VM.print_touched_methods" to connect to the application and save the list of referenced methods into a text file touched_methods.txt
+ Next, invoke java -Xshare:dump to dump the shared archive. The contents of touched_methods.txt will be used to reorder the shared archive to segregate the unreferenced methods into a separate section.
The command-line option to pass touched_methods.txt to "java -Xshare:dump" is TBD.
- relates to
-
JDK-8025692 Log what methods are touched at run-time
-
- Resolved
-