Skip to content

Commit 8f6226b

Browse files
[GR-59582] Better messages for OutOfMemoryErrors and small cleanups/bugfixes.
PullRequest: graal/19233
2 parents 71ed6c9 + 75dd063 commit 8f6226b

File tree

14 files changed

+104
-62
lines changed

14 files changed

+104
-62
lines changed

CENSUS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The project's census with roles as defined in [CONTRIBUTING.md](CONTRIBUTING.md)
1212
* Compiler
1313
* [Doug Simon](https://github.com/dougxc)
1414
* Native Image
15-
* [Christian Wimmer](https://github.com/christianwimmer)
15+
* [Christian Wirth](https://github.com/wirthi)
1616
* Truffle
1717
* [Christian Humer](https://github.com/chumer)
1818
* Espresso
@@ -28,4 +28,4 @@ The project's census with roles as defined in [CONTRIBUTING.md](CONTRIBUTING.md)
2828

2929
### Committers
3030

31-
See https://github.com/oracle/graal/graphs/contributors
31+
See https://github.com/oracle/graal/graphs/contributors

substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/BasicCollectionPolicies.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import com.oracle.svm.core.heap.PhysicalMemory;
3838
import com.oracle.svm.core.heap.ReferenceAccess;
3939
import com.oracle.svm.core.util.TimeUtils;
40+
import com.oracle.svm.core.util.UnsignedUtils;
4041
import com.oracle.svm.core.util.VMError;
4142

4243
/** Basic/legacy garbage collection policies. */
@@ -109,10 +110,7 @@ public final UnsignedWord getMaximumHeapSize() {
109110
int maximumHeapSizePercent = HeapParameters.getMaximumHeapSizePercent();
110111
/* Do not cache because `-Xmx` option parsing may not have happened yet. */
111112
UnsignedWord result = physicalMemorySize.unsignedDivide(100).multiply(maximumHeapSizePercent);
112-
if (result.belowThan(addressSpaceSize)) {
113-
return result;
114-
}
115-
return addressSpaceSize;
113+
return UnsignedUtils.min(result, addressSpaceSize);
116114
}
117115

118116
@Override

substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/HeapChunkProvider.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
* list. Memory for unaligned chunks is released immediately.
5555
*/
5656
final class HeapChunkProvider {
57+
/** These {@link OutOfMemoryError}s are only needed for legacy code, see GR-59639. */
58+
private static final OutOfMemoryError ALIGNED_OUT_OF_MEMORY_ERROR = new OutOfMemoryError("Could not allocate an aligned heap chunk");
59+
private static final OutOfMemoryError UNALIGNED_OUT_OF_MEMORY_ERROR = new OutOfMemoryError("Could not allocate an unaligned heap chunk");
60+
5761
/**
5862
* The head of the linked list of unused aligned chunks. Chunks are chained using
5963
* {@link HeapChunk#getNext}.
@@ -78,10 +82,6 @@ public UnsignedWord getBytesInUnusedChunks() {
7882
return numUnusedAlignedChunks.get().multiply(HeapParameters.getAlignedHeapChunkSize());
7983
}
8084

81-
private static final OutOfMemoryError ALIGNED_OUT_OF_MEMORY_ERROR = new OutOfMemoryError("Could not allocate an aligned heap chunk");
82-
83-
private static final OutOfMemoryError UNALIGNED_OUT_OF_MEMORY_ERROR = new OutOfMemoryError("Could not allocate an unaligned heap chunk");
84-
8585
/** Acquire a new AlignedHeapChunk, either from the free list or from the operating system. */
8686
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
8787
AlignedHeader produceAlignedChunk() {

substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/HeapParameters.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ public static int getHeapChunkHeaderPadding() {
117117

118118
static int getMaximumYoungGenerationSizePercent() {
119119
int result = SerialAndEpsilonGCOptions.MaximumYoungGenerationSizePercent.getValue();
120-
VMError.guarantee((result >= 0) && (result <= 100), "MaximumYoungGenerationSizePercent should be in [0 ..100]");
120+
VMError.guarantee(result >= 0 && result <= 100, "MaximumYoungGenerationSizePercent should be in [0..100]");
121121
return result;
122122
}
123123

124124
static int getMaximumHeapSizePercent() {
125125
int result = SerialAndEpsilonGCOptions.MaximumHeapSizePercent.getValue();
126-
VMError.guarantee((result >= 0) && (result <= 100), "MaximumHeapSizePercent should be in [0 ..100]");
126+
VMError.guarantee(result >= 0 && result <= 100, "MaximumHeapSizePercent should be in [0..100]");
127127
return result;
128128
}
129129

substratevm/src/com.oracle.svm.core.windows/src/com/oracle/svm/core/windows/WindowsPhysicalMemorySupportImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@
2424
*/
2525
package com.oracle.svm.core.windows;
2626

27+
import static com.oracle.svm.core.Uninterruptible.CALLED_FROM_UNINTERRUPTIBLE_CODE;
28+
2729
import org.graalvm.nativeimage.c.struct.SizeOf;
2830
import org.graalvm.word.UnsignedWord;
2931
import org.graalvm.word.WordFactory;
3032

33+
import com.oracle.svm.core.Uninterruptible;
3134
import com.oracle.svm.core.feature.AutomaticallyRegisteredImageSingleton;
3235
import com.oracle.svm.core.graal.stackvalue.UnsafeStackValue;
3336
import com.oracle.svm.core.heap.PhysicalMemory.PhysicalMemorySupport;
@@ -37,6 +40,7 @@
3740
class WindowsPhysicalMemorySupportImpl implements PhysicalMemorySupport {
3841

3942
@Override
43+
@Uninterruptible(reason = CALLED_FROM_UNINTERRUPTIBLE_CODE, mayBeInlined = true)
4044
public UnsignedWord size() {
4145
SysinfoAPI.MEMORYSTATUSEX memStatusEx = UnsafeStackValue.get(SysinfoAPI.MEMORYSTATUSEX.class);
4246
memStatusEx.set_dwLength(SizeOf.get(SysinfoAPI.MEMORYSTATUSEX.class));

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/IsolateArgumentParser.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -553,13 +553,9 @@ private static CCharPointer startsWith(CCharPointer input, CCharPointer prefix)
553553

554554
@Fold
555555
public static int getOptionIndex(RuntimeOptionKey<?> key) {
556-
return singleton().getOptionIndex0(key);
557-
}
558-
559-
@Fold
560-
protected int getOptionIndex0(RuntimeOptionKey<?> key) {
561-
for (int i = 0; i < getOptionCount(); i++) {
562-
if (getOptions()[i] == key) {
556+
RuntimeOptionKey<?>[] options = getOptions();
557+
for (int i = 0; i < options.length; i++) {
558+
if (options[i] == key) {
563559
return i;
564560
}
565561
}
@@ -568,7 +564,7 @@ protected int getOptionIndex0(RuntimeOptionKey<?> key) {
568564
}
569565

570566
@Fold
571-
public int getParsedArgsSize() {
567+
public static int getParsedArgsSize() {
572568
return Long.BYTES * getOptionCount();
573569
}
574570

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateGCOptions.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class SubstrateGCOptions {
5151
@Override
5252
protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, Long oldValue, Long newValue) {
5353
if (!SubstrateUtil.HOSTED) {
54-
HeapSizeVerifier.verifyMinHeapSizeAgainstAddressSpace(WordFactory.unsigned(newValue));
54+
HeapSizeVerifier.verifyMinHeapSizeAgainstMaxAddressSpaceSize(WordFactory.unsigned(newValue));
5555
}
5656
super.onValueUpdate(values, oldValue, newValue);
5757
}
@@ -62,7 +62,7 @@ protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, Long oldV
6262
@Override
6363
protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, Long oldValue, Long newValue) {
6464
if (!SubstrateUtil.HOSTED) {
65-
HeapSizeVerifier.verifyMaxHeapSizeAgainstAddressSpace(WordFactory.unsigned(newValue));
65+
HeapSizeVerifier.verifyMaxHeapSizeAgainstMaxAddressSpaceSize(WordFactory.unsigned(newValue));
6666
}
6767
super.onValueUpdate(values, oldValue, newValue);
6868
}
@@ -73,7 +73,7 @@ protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, Long oldV
7373
@Override
7474
protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, Long oldValue, Long newValue) {
7575
if (!SubstrateUtil.HOSTED) {
76-
HeapSizeVerifier.verifyMaxNewSizeAgainstAddressSpace(WordFactory.unsigned(newValue));
76+
HeapSizeVerifier.verifyMaxNewSizeAgainstMaxAddressSpaceSize(WordFactory.unsigned(newValue));
7777
}
7878
super.onValueUpdate(values, oldValue, newValue);
7979
}

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/code/AbstractRuntimeCodeInstaller.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class AbstractRuntimeCodeInstaller {
4141
protected Pointer allocateCodeMemory(long size) {
4242
PointerBase result = RuntimeCodeInfoAccess.allocateCodeMemory(WordFactory.unsigned(size));
4343
if (result.isNull()) {
44-
throw new OutOfMemoryError();
44+
throw new OutOfMemoryError("Could not allocate memory for runtime-compiled code.");
4545
}
4646
return (Pointer) result;
4747
}

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/graal/snippets/CEntryPointSnippets.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ private static int createIsolate(CEntryPointCreateIsolateParameters providedPara
301301

302302
IsolateArguments arguments = StackValue.get(IsolateArguments.class);
303303
UnmanagedMemoryUtil.fill((Pointer) arguments, SizeOf.unsigned(IsolateArguments.class), (byte) 0);
304-
CLongPointer parsedArgs = StackValue.get(IsolateArgumentParser.singleton().getParsedArgsSize());
304+
CLongPointer parsedArgs = StackValue.get(IsolateArgumentParser.getParsedArgsSize());
305305
arguments.setParsedArgs(parsedArgs);
306306

307307
IsolateArgumentParser.singleton().parse(parameters, arguments);

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/HeapSizeVerifier.java

Lines changed: 63 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -29,63 +29,96 @@
2929

3030
import com.oracle.svm.core.SubstrateGCOptions;
3131
import com.oracle.svm.core.SubstrateUtil;
32-
import com.oracle.svm.core.feature.InternalFeature;
3332
import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature;
33+
import com.oracle.svm.core.feature.InternalFeature;
3434
import com.oracle.svm.core.util.UserError;
3535
import com.oracle.svm.core.util.UserError.UserException;
3636

37+
/**
38+
* Verifies that the heap size options are used consistently. Note that some checks seem redundant
39+
* at first glance. However, those checks are needed because options don't necessarily have a value.
40+
*/
3741
public final class HeapSizeVerifier {
42+
private static final String MAX_HEAP_SIZE_NAME = "maximum heap size";
43+
private static final String MIN_HEAP_SIZE_NAME = "minimum heap size";
44+
private static final String MAX_NEW_SIZE_NAME = "maximum new generation size";
45+
46+
/**
47+
* This method is executed once at build-time and once at runtime-time (after parsing all option
48+
* values).
49+
*/
3850
public static void verifyHeapOptions() {
39-
UnsignedWord minHeapSize = WordFactory.unsigned(SubstrateGCOptions.MinHeapSize.getValue());
51+
verifyReservedAddressSpaceSize();
52+
verifyMaxHeapSize();
53+
verifyMinHeapSize();
54+
verifyMaxNewSize();
55+
}
56+
57+
private static void verifyReservedAddressSpaceSize() {
58+
UnsignedWord reservedAddressSpaceSize = WordFactory.unsigned(SubstrateGCOptions.ReservedAddressSpaceSize.getValue());
59+
verifyAgainstMaxAddressSpaceSize(reservedAddressSpaceSize, "value of the option '" + SubstrateGCOptions.ReservedAddressSpaceSize.getName() + "'");
60+
}
61+
62+
private static void verifyMaxHeapSize() {
4063
UnsignedWord maxHeapSize = WordFactory.unsigned(SubstrateGCOptions.MaxHeapSize.getValue());
41-
UnsignedWord maxNewSize = WordFactory.unsigned(SubstrateGCOptions.MaxNewSize.getValue());
64+
verifyMaxHeapSizeAgainstMaxAddressSpaceSize(maxHeapSize);
65+
verifyAgainstReservedAddressSpaceSize(maxHeapSize, MAX_HEAP_SIZE_NAME);
66+
}
67+
68+
private static void verifyMinHeapSize() {
69+
UnsignedWord minHeapSize = WordFactory.unsigned(SubstrateGCOptions.MinHeapSize.getValue());
70+
verifyMinHeapSizeAgainstMaxAddressSpaceSize(minHeapSize);
71+
verifyAgainstReservedAddressSpaceSize(minHeapSize, MIN_HEAP_SIZE_NAME);
4272

43-
verifyMaxHeapSizeAgainstAddressSpace(maxHeapSize);
44-
verifyMinHeapSizeAgainstAddressSpace(minHeapSize);
45-
verifyMaxNewSizeAgainstAddressSpace(maxNewSize);
46-
verifyMinHeapSizeAgainstMaxHeapSize(minHeapSize);
47-
verifyMaxNewSizeAgainstMaxHeapSize(maxHeapSize);
73+
UnsignedWord maxHeapSize = WordFactory.unsigned(SubstrateGCOptions.MaxHeapSize.getValue());
74+
if (maxHeapSize.notEqual(0) && minHeapSize.aboveThan(maxHeapSize)) {
75+
throwError(minHeapSize, MIN_HEAP_SIZE_NAME, maxHeapSize, MAX_HEAP_SIZE_NAME);
76+
}
4877
}
4978

50-
public static void verifyMinHeapSizeAgainstAddressSpace(UnsignedWord minHeapSize) throws UserException {
51-
verifyAgainstAddressSpace(minHeapSize, "minimum heap size");
79+
private static void verifyMaxNewSize() {
80+
UnsignedWord maxNewSize = WordFactory.unsigned(SubstrateGCOptions.MaxNewSize.getValue());
81+
verifyMaxNewSizeAgainstMaxAddressSpaceSize(maxNewSize);
82+
verifyAgainstReservedAddressSpaceSize(maxNewSize, MAX_NEW_SIZE_NAME);
83+
84+
UnsignedWord maxHeapSize = WordFactory.unsigned(SubstrateGCOptions.MaxHeapSize.getValue());
85+
if (maxHeapSize.notEqual(0) && maxNewSize.aboveThan(maxHeapSize)) {
86+
throwError(maxNewSize, MAX_NEW_SIZE_NAME, maxHeapSize, MAX_HEAP_SIZE_NAME);
87+
}
5288
}
5389

54-
public static void verifyMaxHeapSizeAgainstAddressSpace(UnsignedWord maxHeapSize) throws UserException {
55-
verifyAgainstAddressSpace(maxHeapSize, "maximum heap size");
90+
public static void verifyMinHeapSizeAgainstMaxAddressSpaceSize(UnsignedWord minHeapSize) throws UserException {
91+
verifyAgainstMaxAddressSpaceSize(minHeapSize, MIN_HEAP_SIZE_NAME);
5692
}
5793

58-
public static void verifyMaxNewSizeAgainstAddressSpace(UnsignedWord maxNewSize) {
59-
verifyAgainstAddressSpace(maxNewSize, "maximum new generation size");
94+
public static void verifyMaxHeapSizeAgainstMaxAddressSpaceSize(UnsignedWord maxHeapSize) throws UserException {
95+
verifyAgainstMaxAddressSpaceSize(maxHeapSize, MAX_HEAP_SIZE_NAME);
6096
}
6197

62-
private static void verifyAgainstAddressSpace(UnsignedWord actualValue, String actualValueName) {
63-
UnsignedWord addressSpaceSize = ReferenceAccess.singleton().getAddressSpaceSize();
64-
if (actualValue.aboveThan(addressSpaceSize)) {
65-
throwError(actualValue, actualValueName, addressSpaceSize, "largest possible address space");
66-
}
98+
public static void verifyMaxNewSizeAgainstMaxAddressSpaceSize(UnsignedWord maxNewSize) {
99+
verifyAgainstMaxAddressSpaceSize(maxNewSize, MAX_NEW_SIZE_NAME);
67100
}
68101

69-
private static void verifyMinHeapSizeAgainstMaxHeapSize(UnsignedWord minHeapSize) {
70-
UnsignedWord maxHeapSize = WordFactory.unsigned(SubstrateGCOptions.MaxHeapSize.getValue());
71-
if (maxHeapSize.notEqual(0) && minHeapSize.aboveThan(maxHeapSize)) {
72-
throwError(minHeapSize, "minimum heap size", maxHeapSize, "maximum heap size");
102+
private static void verifyAgainstMaxAddressSpaceSize(UnsignedWord actualValue, String actualValueName) {
103+
UnsignedWord maxAddressSpaceSize = ReferenceAccess.singleton().getAddressSpaceSize();
104+
if (actualValue.aboveThan(maxAddressSpaceSize)) {
105+
throwError(actualValue, actualValueName, maxAddressSpaceSize, "largest possible heap address space");
73106
}
74107
}
75108

76-
private static void verifyMaxNewSizeAgainstMaxHeapSize(UnsignedWord maxNewSize) {
77-
UnsignedWord maxHeapSize = WordFactory.unsigned(SubstrateGCOptions.MaxHeapSize.getValue());
78-
if (maxHeapSize.notEqual(0) && maxNewSize.aboveThan(maxHeapSize)) {
79-
throwError(maxNewSize, "maximum new generation size", maxHeapSize, "maximum heap size");
109+
private static void verifyAgainstReservedAddressSpaceSize(UnsignedWord actualValue, String actualValueName) {
110+
UnsignedWord reservedAddressSpaceSize = WordFactory.unsigned(SubstrateGCOptions.ReservedAddressSpaceSize.getValue());
111+
if (reservedAddressSpaceSize.notEqual(0) && actualValue.aboveThan(reservedAddressSpaceSize)) {
112+
throwError(actualValue, actualValueName, reservedAddressSpaceSize, "value of the option '" + SubstrateGCOptions.ReservedAddressSpaceSize.getName() + "'");
80113
}
81114
}
82115

83116
private static void throwError(UnsignedWord actualValue, String actualValueName, UnsignedWord maxValue, String maxValueName) throws UserException {
84117
if (SubstrateUtil.HOSTED) {
85-
throw UserError.abort("The specified %s (%s) is larger than the %s (%s).", actualValueName, format(actualValue), maxValueName, format(maxValue));
118+
throw UserError.abort("The specified %s (%s) must not be larger than the %s (%s).", actualValueName, format(actualValue), maxValueName, format(maxValue));
86119
} else {
87120
throw new IllegalArgumentException(
88-
"The specified " + actualValueName + " (" + format(actualValue) + ") is larger than the " + maxValueName + " (" + format(maxValue) + ").");
121+
"The specified " + actualValueName + " (" + format(actualValue) + ") must not be larger than the " + maxValueName + " (" + format(maxValue) + ").");
89122
}
90123
}
91124

@@ -105,8 +138,7 @@ private static String format(UnsignedWord bytes) {
105138
class HostedHeapSizeVerifierFeature implements InternalFeature {
106139
@Override
107140
public void beforeAnalysis(BeforeAnalysisAccess access) {
108-
// At build-time, we can do a reasonable GC-independent verification of all the heap size
109-
// settings.
141+
/* At build-time, we can do a GC-independent verification of all the heap size settings. */
110142
HeapSizeVerifier.verifyHeapOptions();
111143
}
112144
}

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jfr/JfrTypeRepository.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,8 @@ private long getClassLoaderId(TypeInfo typeInfo, ClassLoader classLoader) {
313313
return flushedClassLoaders.get(classLoader);
314314
}
315315
return typeInfo.classLoaders.get(classLoader);
316-
} else {
317-
return 0;
318316
}
317+
return 0;
319318
}
320319

321320
private void clearEpochData() {

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/os/AbstractImageHeapProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected static UnsignedWord getImageHeapSizeInFile(Word beginAddress, Word end
6969
}
7070

7171
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
72-
protected static UnsignedWord getImageHeapSizeInFile() {
72+
public static UnsignedWord getImageHeapSizeInFile() {
7373
return getImageHeapSizeInFile(IMAGE_HEAP_BEGIN.get(), IMAGE_HEAP_END.get());
7474
}
7575

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/os/ChunkBasedCommittedMemoryProvider.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,31 @@
3838
import jdk.graal.compiler.api.replacements.Fold;
3939

4040
public abstract class ChunkBasedCommittedMemoryProvider extends AbstractCommittedMemoryProvider {
41+
private static final OutOfMemoryError ALIGNED_OUT_OF_MEMORY_ERROR = new OutOfMemoryError("Could not allocate an aligned heap chunk. " +
42+
"Either the OS/container is out of memory or another system-level resource limit was reached (such as the number of memory mappings).");
43+
private static final OutOfMemoryError UNALIGNED_OUT_OF_MEMORY_ERROR = new OutOfMemoryError("Could not allocate an unaligned heap chunk. " +
44+
"Either the OS/container is out of memory or another system-level resource limit was reached (such as the number of memory mappings).");
45+
4146
@Fold
4247
public static ChunkBasedCommittedMemoryProvider get() {
4348
return (ChunkBasedCommittedMemoryProvider) ImageSingletons.lookup(CommittedMemoryProvider.class);
4449
}
4550

4651
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
4752
public Pointer allocateAlignedChunk(UnsignedWord nbytes, UnsignedWord alignment) {
48-
return allocate(nbytes, alignment, false, NmtCategory.JavaHeap);
53+
Pointer result = allocate(nbytes, alignment, false, NmtCategory.JavaHeap);
54+
if (result.isNull()) {
55+
throw ALIGNED_OUT_OF_MEMORY_ERROR;
56+
}
57+
return result;
4958
}
5059

5160
public Pointer allocateUnalignedChunk(UnsignedWord nbytes) {
52-
return allocate(nbytes, getAlignmentForUnalignedChunks(), false, NmtCategory.JavaHeap);
61+
Pointer result = allocate(nbytes, getAlignmentForUnalignedChunks(), false, NmtCategory.JavaHeap);
62+
if (result.isNull()) {
63+
throw UNALIGNED_OUT_OF_MEMORY_ERROR;
64+
}
65+
return result;
5366
}
5467

5568
/**

substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/isolated/IsolatedRuntimeCodeInstaller.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private IsolatedRuntimeCodeInstaller(IsolateThread targetIsolate, SharedRuntimeM
148148
protected Pointer allocateCodeMemory(long size) {
149149
PointerBase memory = allocateCodeMemory0(targetIsolate, WordFactory.unsigned(size));
150150
if (memory.isNull()) {
151-
throw new OutOfMemoryError();
151+
throw new OutOfMemoryError("Could not allocate memory for runtime-compiled code.");
152152
}
153153
return (Pointer) memory;
154154
}

0 commit comments

Comments
 (0)