wForget commented on code in PR #7396:
URL: https://github.com/apache/incubator-gluten/pull/7396#discussion_r1792727265
##########
cpp/core/memory/MemoryAllocator.cc:
##########
@@ -50,9 +50,13 @@ bool ListenableMemoryAllocator::allocateAligned(uint64_t
alignment, int64_t size
bool ListenableMemoryAllocator::reallocate(void* p, int64_t size, int64_t
newSize, void** out) {
int64_t diff = newSize - size;
- updateUsage(diff);
+ if (diff > 0) {
+ updateUsage(diff);
+ }
bool succeed = delegated_->reallocate(p, size, newSize, out);
- if (!succeed) {
+ if (succeed && diff < 0) {
+ updateUsage(diff);
+ } else if (!succeed && diff > 0) {
updateUsage(-diff);
}
return succeed;
Review Comment:
thanks, changed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]