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

Function TakeBlocksFromGlobalFreeList

library/cpp/lfalloc/lf_allocX64.h:962–977  ·  view source on GitHub ↗

take several blocks from global free list (max FL_GROUP_SIZE blocks), returns number of blocks taken buf should have space for at least FL_GROUP_SIZE elems

Source from the content-addressed store, hash-verified

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
962static Y_FORCE_INLINE int TakeBlocksFromGlobalFreeList(int nSizeIdx, char** buf) {
963 TLFAllocFreeList& fl = globalFreeLists[nSizeIdx];
964 TFreeListGroup* g = (TFreeListGroup*)fl.Alloc();
965 if (g) {
966 int resCount = 0;
967 for (auto ptr : g->Ptrs) {
968 if (ptr)
969 buf[resCount++] = ptr;
970 else
971 break;
972 }
973 blockFreeList.Free(g);
974 return resCount;
975 }
976 return 0;
977}
978
979// add several blocks to global free list
980static Y_FORCE_INLINE void PutBlocksToGlobalFreeList(ptrdiff_t nSizeIdx, char** buf, int count) {

Callers 1

LFAllocImplFunction · 0.85

Calls 2

AllocMethod · 0.45
FreeMethod · 0.45

Tested by

no test coverage detected