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

Method check_capacity

util/memory/segmented_string_pool.h:48–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46 const char* Name; // for debug memory usage
47protected:
48 void check_capacity(size_t len) {
49 if (Y_UNLIKELY(!last_free || len > last_free)) {
50 if (curseg != segs.end() && curseg->freepos > 0) {
51 ++curseg;
52 }
53 last_free = (len > segment_size ? len : segment_size);
54 if (curseg == segs.end() || curseg->_size < last_free) {
55 segs.push_back(seg_inf(seg_allocator.allocate(last_free), last_free));
56 if (Y_UNLIKELY(Name)) {
57 printf("Pool \"%s\" was increased by %" PRISZT " bytes to %" PRISZT " Mb.\n", Name, last_free * sizeof(T), capacity() / 0x100000);
58 }
59 curseg = segs.end() - 1;
60 }
61 Y_ASSERT(curseg->freepos == 0);
62 Y_ASSERT(curseg->_size >= last_free);
63 }
64 }
65
66public:
67 explicit segmented_pool(size_t segsz, const char* name = nullptr)

Callers

nothing calls this directly

Calls 5

seg_infClass · 0.85
capacityFunction · 0.50
endMethod · 0.45
push_backMethod · 0.45
allocateMethod · 0.45

Tested by

no test coverage detected