add mem check

This commit is contained in:
yihaoDeng 2024-08-08 19:35:20 +08:00
parent 6be6027d17
commit 2af86c961a
3 changed files with 4 additions and 8 deletions

View File

@ -907,7 +907,6 @@ static int32_t specifyConnRef(SCliConn* conn, bool update, int64_t handle) {
taosWUnLockLatch(&exh->latch); taosWUnLockLatch(&exh->latch);
conn->refId = exh->refId; conn->refId = exh->refId;
taosWUnLockLatch(&exh->latch);
tDebug("conn %p specified by %" PRId64 "", conn, handle); tDebug("conn %p specified by %" PRId64 "", conn, handle);
@ -1978,6 +1977,7 @@ static void cliBatchDealReq(queue* wq, SCliThrd* pThrd) {
continue; continue;
} }
QUEUE_INIT(&pBatchList->wq); QUEUE_INIT(&pBatchList->wq);
pBatchList->port = port;
pBatchList->connMax = pInst->connLimitNum; pBatchList->connMax = pInst->connLimitNum;
pBatchList->connCnt = 0; pBatchList->connCnt = 0;
pBatchList->batchLenLimit = pInst->batchSize; pBatchList->batchLenLimit = pInst->batchSize;
@ -1993,7 +1993,6 @@ static void cliBatchDealReq(queue* wq, SCliThrd* pThrd) {
tError("failed to create batch list, reason:%s", tstrerror(TSDB_CODE_OUT_OF_MEMORY)); tError("failed to create batch list, reason:%s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
continue; continue;
} }
pBatchList->port = port;
SCliBatch* pBatch = taosMemoryCalloc(1, sizeof(SCliBatch)); SCliBatch* pBatch = taosMemoryCalloc(1, sizeof(SCliBatch));
if (pBatch == NULL) { if (pBatch == NULL) {

View File

@ -441,15 +441,12 @@ void transReqQueueClear(queue* q) {
} }
int32_t transQueueInit(STransQueue* queue, void (*freeFunc)(const void* arg)) { int32_t transQueueInit(STransQueue* queue, void (*freeFunc)(const void* arg)) {
queue->q = taosArrayInit(4, sizeof(void*)); queue->q = taosArrayInit(2, sizeof(void*));
if (taosArrayReserve(queue->q, 4) == NULL) { if (queue->q == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
queue->freeFunc = (void (*)(const void*))freeFunc; queue->freeFunc = (void (*)(const void*))freeFunc;
if (queue->q == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
}
return 0; return 0;
} }
bool transQueuePush(STransQueue* queue, void* arg) { bool transQueuePush(STransQueue* queue, void* arg) {

View File

@ -541,7 +541,7 @@ void uvOnRecvCb(uv_stream_t* cli, ssize_t nread, const uv_buf_t* buf) {
void uvAllocConnBufferCb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) { void uvAllocConnBufferCb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) {
buf->len = 2; buf->len = 2;
buf->base = taosMemoryCalloc(1, sizeof(char) * buf->len); buf->base = taosMemoryCalloc(1, sizeof(char) * buf->len);
if (buf == NULL) { if (buf->base == NULL) {
tError("failed to alloc conn read buffer since %s", tstrerror(TSDB_CODE_OUT_OF_MEMORY)); tError("failed to alloc conn read buffer since %s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
} }
} }