diff --git a/source/util/src/tqueue.c b/source/util/src/tqueue.c index db75c6b2ff3..0b4ed6dbc29 100644 --- a/source/util/src/tqueue.c +++ b/source/util/src/tqueue.c @@ -152,9 +152,9 @@ int64_t taosQueueMemorySize(STaosQueue *queue) { int32_t taosAllocateQitem(int32_t size, EQItype itype, int64_t dataSize, void **item) { int64_t alloced = -1; - if (alloced > tsQueueMemoryAllowed) { + if (itype == RPC_QITEM) { alloced = atomic_add_fetch_64(&tsQueueMemoryUsed, size + dataSize); - if (itype == RPC_QITEM) { + if (alloced > tsQueueMemoryAllowed) { uError("failed to alloc qitem, size:%" PRId64 " alloc:%" PRId64 " allowed:%" PRId64, size + dataSize, alloced, tsQueueMemoryAllowed); (void)atomic_sub_fetch_64(&tsQueueMemoryUsed, size + dataSize);