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

Function SampleAllocation

library/cpp/lfalloc/lf_allocX64.h:1400–1412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1398
1399static const int DBG_ALLOC_INVALID_COOKIE = -1;
1400static inline int SampleAllocation(TAllocHeader* p, int sizeIdx) {
1401 int cookie = DBG_ALLOC_INVALID_COOKIE;
1402 if (AllocationSamplingEnabled && (ProfileCurrentThread || ProfileAllThreads) && !InAllocationCallback) {
1403 if (p->Size > AllocationSampleMaxSize || ++AllocationsCount % AllocationSampleRate == 0) {
1404 if (AllocationCallback) {
1405 InAllocationCallback = true;
1406 cookie = AllocationCallback(p->Tag, p->Size, sizeIdx);
1407 InAllocationCallback = false;
1408 }
1409 }
1410 }
1411 return cookie;
1412}
1413
1414static inline void SampleDeallocation(TAllocHeader* p, int sizeIdx) {
1415 if (p->Cookie != DBG_ALLOC_INVALID_COOKIE && !InAllocationCallback) {

Callers 1

TrackAllocationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected