MCPcopy Create free account
hub / github.com/catboost/catboost / LFAllocNoCacheMultiple

Function LFAllocNoCacheMultiple

library/cpp/lfalloc/lf_allocX64.h:945–958  ·  view source on GitHub ↗

allocate multiple blocks, returns number of blocks allocated (max FL_GROUP_SIZE) buf should have space for at least FL_GROUP_SIZE elems

Source from the content-addressed store, hash-verified

943// allocate multiple blocks, returns number of blocks allocated (max FL_GROUP_SIZE)
944// buf should have space for at least FL_GROUP_SIZE elems
945static Y_FORCE_INLINE int LFAllocNoCacheMultiple(int nSizeIdx, char** buf) {
946 int blockSize = nSizeIdxToSize[nSizeIdx];
947 void* res = LFAllocFromCurrentChunk(nSizeIdx, blockSize, FL_GROUP_SIZE);
948 if (res) {
949 char* resPtr = (char*)res;
950 for (int k = 0; k < FL_GROUP_SIZE; ++k) {
951 buf[k] = resPtr;
952 resPtr += blockSize;
953 }
954 return FL_GROUP_SIZE;
955 }
956 buf[0] = (char*)SlowLFAlloc(nSizeIdx, blockSize, MEM_DEFRAG);
957 return 1;
958}
959
960// take several blocks from global free list (max FL_GROUP_SIZE blocks), returns number of blocks taken
961// buf should have space for at least FL_GROUP_SIZE elems

Callers 1

LFAllocImplFunction · 0.85

Calls 2

LFAllocFromCurrentChunkFunction · 0.85
SlowLFAllocFunction · 0.85

Tested by

no test coverage detected