|
1 | 1 | /* |
2 | | - * Copyright (c) 2017, 2020, Red Hat, Inc. All rights reserved. |
| 2 | + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. |
| 3 | + * Copyright (c) 2017, 2022, Red Hat, Inc. All rights reserved. |
3 | 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 5 | * |
5 | 6 | * This code is free software; you can redistribute it and/or modify it |
@@ -126,14 +127,15 @@ HeapWord* EpsilonHeap::allocate_work(size_t size) { |
126 | 127 | } |
127 | 128 |
|
128 | 129 | // Expand and loop back if space is available |
| 130 | + size_t size_in_bytes = size * HeapWordSize; |
129 | 131 | size_t space_left = max_capacity() - capacity(); |
130 | | - size_t want_space = MAX2(size, EpsilonMinHeapExpand); |
| 132 | + size_t want_space = MAX2(size_in_bytes, EpsilonMinHeapExpand); |
131 | 133 |
|
132 | 134 | if (want_space < space_left) { |
133 | 135 | // Enough space to expand in bulk: |
134 | 136 | bool expand = _virtual_space.expand_by(want_space); |
135 | 137 | assert(expand, "Should be able to expand"); |
136 | | - } else if (size < space_left) { |
| 138 | + } else if (size_in_bytes < space_left) { |
137 | 139 | // No space to expand in bulk, and this allocation is still possible, |
138 | 140 | // take all the remaining space: |
139 | 141 | bool expand = _virtual_space.expand_by(space_left); |
|
0 commit comments