diff --git a/kuiper/source/base/buffer.cpp b/kuiper/source/base/buffer.cpp index 2af41e8..cefe5a2 100644 --- a/kuiper/source/base/buffer.cpp +++ b/kuiper/source/base/buffer.cpp @@ -18,6 +18,7 @@ Buffer::Buffer(size_t byte_size, std::shared_ptr allocator, voi Buffer::~Buffer() { if (!use_external_) { if (ptr_ && allocator_) { + LOG(INFO) << "Release..."; allocator_->release(ptr_); ptr_ = nullptr; } diff --git a/test/test_buffer.cpp b/test/test_buffer.cpp index 37ee4b9..03e6ca5 100644 --- a/test/test_buffer.cpp +++ b/test/test_buffer.cpp @@ -2,11 +2,15 @@ #include #include "base/buffer.h" -TEST(test_buffer, allocate) { + + +TEST(test_buffer, allocate2) { using namespace base; auto alloc = base::CPUDeviceAllocatorFactory::get_instance(); - Buffer buffer(32, alloc); - ASSERT_NE(buffer.ptr(), nullptr); + std::shared_ptr buffer; + { buffer = std::make_shared(32, alloc); } + LOG(INFO) << "HERE"; + ASSERT_NE(buffer->ptr(), nullptr); } TEST(test_buffer, use_external) {