bug: fix allocation size overflow at log

This commit is contained in:
hongruichen 2024-07-18 19:44:05 +08:00
parent d82b3a0bdb
commit 15f5cc450c

View file

@ -599,9 +599,9 @@ public:
return nullptr;
}
auto allocate_bytes = static_cast<int32_t>(bytes + alignment);
void *buf = _pfn_rpc_mem_alloc(RPCMEM_HEAP_ID_SYSTEM, RPCMEM_DEFAULT_FLAGS, allocate_bytes);
if (buf == nullptr) {
auto allocate_bytes = static_cast<int64_t>(bytes + alignment);
void *buf = _pfn_rpc_mem_alloc(RPCMEM_HEAP_ID_SYSTEM, RPCMEM_DEFAULT_FLAGS, (int)allocate_bytes);
if (!buf) {
QNN_LOG_WARN("failed to allocate rpc memory, size: %d MB\n", (int)(allocate_bytes / (1 << 20)));
return nullptr;
}