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

Function TEST

test/memory.cpp:42–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40const size_t step_bytes = 1024;
41
42TEST(Memory, Scope) {
43 size_t alloc_bytes, alloc_buffers;
44 size_t lock_bytes, lock_buffers;
45
46 cleanSlate(); // Clean up everything done so far
47
48 {
49 array a = randu(5, 5);
50
51 deviceMemInfo(&alloc_bytes, &alloc_buffers, &lock_bytes, &lock_buffers);
52
53 ASSERT_EQ(alloc_buffers, 1u);
54 ASSERT_EQ(lock_buffers, 1u);
55
56 ASSERT_EQ(alloc_bytes, 1 * step_bytes);
57 ASSERT_EQ(lock_bytes, 1 * step_bytes);
58 }
59
60 deviceMemInfo(&alloc_bytes, &alloc_buffers, &lock_bytes, &lock_buffers);
61
62 ASSERT_EQ(alloc_buffers, 1u);
63 ASSERT_EQ(lock_buffers, 0u); // 0 because a is out of scope
64
65 ASSERT_EQ(alloc_bytes, 1 * step_bytes);
66 ASSERT_EQ(lock_bytes, 0u);
67}
68
69template<typename T>
70class MemAlloc : public ::testing::Test {

Callers

nothing calls this directly

Calls 15

cleanSlateFunction · 0.85
randuFunction · 0.85
deviceMemInfoFunction · 0.85
seqClass · 0.85
deviceGCFunction · 0.85
allocV2Function · 0.85
freeV2Function · 0.85
hostMethod · 0.80
lockMethod · 0.80
bytesMethod · 0.80
numdimsMethod · 0.80
af_create_arrayFunction · 0.50

Tested by

no test coverage detected