mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-21 19:08:31 +00:00
8360941: [ubsan] MemRegion::end() shows runtime error: applying non-zero offset 8388608 to null pointer
Co-authored-by: Kim Barrett <kbarrett@openjdk.org> Co-authored-by: Thomas Stuefe <stuefe@openjdk.org> Reviewed-by: kbarrett, lucy
This commit is contained in:
parent
5160cfb496
commit
ceb0c0fc39
@ -44,7 +44,10 @@ TEST_OTHER_VM(G1FreeRegionList, length) {
|
||||
|
||||
// Create a fake heap. It does not need to be valid, as the G1HeapRegion constructor
|
||||
// does not access it.
|
||||
MemRegion heap(nullptr, num_regions_in_test * G1HeapRegion::GrainWords);
|
||||
const size_t szw = num_regions_in_test * G1HeapRegion::GrainWords;
|
||||
const size_t sz = szw * BytesPerWord;
|
||||
char* addr = os::reserve_memory_aligned(sz, G1HeapRegion::GrainBytes, mtTest);
|
||||
MemRegion heap((HeapWord*)addr, szw);
|
||||
|
||||
// Allocate a fake BOT because the G1HeapRegion constructor initializes
|
||||
// the BOT.
|
||||
@ -87,5 +90,6 @@ TEST_OTHER_VM(G1FreeRegionList, length) {
|
||||
|
||||
bot_storage->uncommit_regions(0, num_regions_in_test);
|
||||
delete bot_storage;
|
||||
os::release_memory(addr, sz);
|
||||
FREE_C_HEAP_ARRAY(HeapWord, bot_data);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user