| 107 | } |
| 108 | |
| 109 | static void check_memory_leak() { |
| 110 | if (is_debug_allocator_enabled()) { |
| 111 | butil::IOBuf::Block* p = butil::iobuf::get_tls_block_head(); |
| 112 | size_t n = 0; |
| 113 | while (p) { |
| 114 | ASSERT_TRUE(s_set.seek(p)) << "Memory leak: " << p; |
| 115 | p = butil::iobuf::get_portal_next(p); |
| 116 | ++n; |
| 117 | } |
| 118 | ASSERT_EQ(n, s_set.size()); |
| 119 | ASSERT_EQ(n, (size_t)butil::iobuf::get_tls_block_count()); |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | class IOBufTest : public ::testing::Test{ |
| 124 | protected: |
no test coverage detected