File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jfr Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -75,12 +75,29 @@ public JfrOptionSet() {
7575 }
7676
7777 public void validateAndAdjustMemoryOptions () {
78+ maybeAdjustDefaults ();
7879 ensureValidMinimumSizes ();
7980 ensureValidMemoryRelations ();
8081 adjustMemoryOptions ();
8182 assert checkPostCondition ();
8283 }
8384
85+ /**
86+ * We expect that Native Image executables will require lesser defaults than JFR on the JVM. So
87+ * to reduce JFR native memory consumption, we use lower default values. We should not adjust
88+ * default values too early (at build time) because if any settings are user defined, we
89+ * shouldn't change any values.
90+ */
91+ private void maybeAdjustDefaults () {
92+ if (!globalBufferSize .isUserValue () && !globalBufferCount .isUserValue () && !maxChunkSize .isUserValue ()) {
93+ globalBufferSize .setValue (globalBufferSize .defaultValue / 2 );
94+ globalBufferCount .setValue (globalBufferCount .defaultValue / 2 );
95+ maxChunkSize .setValue (maxChunkSize .defaultValue / 2 );
96+ // Update record of total size
97+ memorySize .setValue (globalBufferSize .getValue () * globalBufferCount .getValue ());
98+ }
99+ }
100+
84101 private void ensureValidMinimumSizes () {
85102 if (memorySize .isUserValue () && memorySize .getValue () < MIN_MEMORY_SIZE ) {
86103 throw new IllegalStateException ("The value specified for the JFR option 'memorysize' is too low. Please use at least " + MIN_MEMORY_SIZE + " bytes." );
You can’t perform that action at this time.
0 commit comments