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

Method Alloc

library/cpp/netliba/v6/ib_mem.cpp:89–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87 }
88
89 TIBMemBlock* TIBMemPool::Alloc(size_t sz) {
90 TGuard<TMutex> gg(CacheLock);
91 if (sz > IB_MEM_LARGE_BLOCK) {
92 TIntrusivePtr<TIBMemSuperBlock> super = AllocSuper(sz);
93 return new TIBMemBlock(super, super->GetData(), sz);
94 } else {
95 if (CurrentOffset + sz > IB_MEM_LARGE_BLOCK) {
96 CurrentBlk.Assign(AllocSuper(IB_MEM_LARGE_BLOCK));
97 CurrentOffset = 0;
98 }
99 CurrentOffset += sz;
100 return new TIBMemBlock(CurrentBlk.Get(), CurrentBlk.Get()->GetData() + CurrentOffset - sz, sz);
101 }
102 }
103
104 void TIBMemPool::Return(TPtrArg<TIBMemSuperBlock> blk) {
105 TGuard<TMutex> gg(CacheLock);

Callers 7

TAllDataSyncMethod · 0.45
RunBWTestMethod · 0.45
ParsePacketMethod · 0.45
CopyMethod · 0.45
ThreadFuncMethod · 0.45
WriteImplMethod · 0.45
CreateBlocksMethod · 0.45

Calls 3

GetDataMethod · 0.45
AssignMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected