Skip to content

Commit 83d10f7

Browse files
committed
add some assertions to runtime light allocator
1 parent ac57e70 commit 83d10f7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

runtime-light/allocator/runtime-light-allocator.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ void RuntimeAllocator::free() {
6363
}
6464

6565
void* RuntimeAllocator::alloc_script_memory(size_t size) noexcept {
66+
kphp::log::assertion(size != 0);
6667
void* mem{memory_resource.allocate(size)};
6768
if (mem == nullptr) [[unlikely]] {
6869
request_extra_memory(size);
@@ -73,6 +74,7 @@ void* RuntimeAllocator::alloc_script_memory(size_t size) noexcept {
7374
}
7475

7576
void* RuntimeAllocator::alloc0_script_memory(size_t size) noexcept {
77+
kphp::log::assertion(size != 0);
7678
void* mem{memory_resource.allocate0(size)};
7779
if (mem == nullptr) [[unlikely]] {
7880
request_extra_memory(size);
@@ -94,6 +96,7 @@ void* RuntimeAllocator::realloc_script_memory(void* old_mem, size_t new_size, si
9496
}
9597

9698
void RuntimeAllocator::free_script_memory(void* mem, size_t size) noexcept {
99+
kphp::log::assertion(size != 0);
97100
memory_resource.deallocate(mem, size);
98101
}
99102

0 commit comments

Comments
 (0)