MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / TEST

Function TEST

src/core/test/mem_alloc.cpp:142–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140} // anonymous namespace
141
142TEST(TestMemAlloc, Reserve) {
143 constexpr size_t TOT = 2048;
144
145 using StreamKey = DevMemAlloc::StreamKey;
146 auto raw_alloc = std::make_shared<DummyAllocator>(TOT);
147 auto runtime_policy = std::make_shared<DummyRuntimePolicy>(0);
148 auto dev_alloc = DevMemAlloc::make(0, TOT, raw_alloc, runtime_policy);
149
150 StreamKey stream_key = nullptr;
151 auto strm_alloc = dev_alloc->add_stream(static_cast<StreamKey>(&stream_key));
152 EXPECT_EQ(0u, strm_alloc->get_free_memory().tot);
153 EXPECT_EQ(2048u, dev_alloc->get_free_memory().tot);
154}
155
156TEST(TestMemAlloc, ReserveOutOfMemory) {
157 constexpr size_t TOT = 2048;

Callers

nothing calls this directly

Calls 15

maxFunction · 0.85
swapFunction · 0.85
test_gather_otherFunction · 0.85
parseFunction · 0.85
test_free_memFunction · 0.85
get_chunk_endMethod · 0.80
backMethod · 0.80
emplace_backMethod · 0.80
free_sizeMethod · 0.80
nr_freeMethod · 0.80
joinMethod · 0.80
nr_allocMethod · 0.80

Tested by

no test coverage detected