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

Method Init

library/cpp/lfalloc/lf_allocX64.h:1117–1147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1115#endif
1116
1117 void Init(TThreadAllocInfo** pHead) {
1118 memset(this, 0, sizeof(*this));
1119 for (auto& i : FreePtrIndex)
1120 i = THREAD_BUF;
1121#ifdef _win_
1122 BOOL b = DuplicateHandle(
1123 GetCurrentProcess(), GetCurrentThread(),
1124 GetCurrentProcess(), &hThread,
1125 0, FALSE, DUPLICATE_SAME_ACCESS);
1126 Y_ASSERT_NOBT(b);
1127#endif
1128 pNextInfo = *pHead;
1129 *pHead = this;
1130 for (int k = 0; k < N_SIZES; ++k) {
1131 int maxCount = MAX_MEM_PER_SIZE_PER_THREAD / nSizeIdxToSize[k];
1132 if (maxCount > THREAD_BUF)
1133 maxCount = THREAD_BUF;
1134 borderSizes[k] = THREAD_BUF - maxCount;
1135 }
1136 for (int i = 0; i < CT_MAX; ++i) {
1137 LocalCounters[i].Init(&GlobalCounters[i]);
1138 }
1139#if defined(LFALLOC_DBG)
1140 for (int tag = 0; tag < DBG_ALLOC_MAX_TAG; ++tag) {
1141 for (int sizeIdx = 0; sizeIdx < DBG_ALLOC_NUM_SIZES; ++sizeIdx) {
1142 auto& local = LocalPerTagAllocCounters[tag][sizeIdx];
1143 local.Init();
1144 }
1145 }
1146#endif
1147 }
1148 void Done() {
1149 for (auto sizeIdx : FreePtrIndex) {
1150 Y_ASSERT_NOBT(sizeIdx == THREAD_BUF);

Callers

nothing calls this directly

Calls 1

InitMethod · 0.45

Tested by

no test coverage detected