wForget commented on code in PR #7648:
URL: https://github.com/apache/incubator-gluten/pull/7648#discussion_r1816534468
##########
cpp/velox/tests/MemoryManagerTest.cc:
##########
@@ -129,4 +129,280 @@ TEST_F(MemoryManagerTest,
memoryAllocatorWithBlockReservation) {
ASSERT_EQ(allocator_->getBytes(), 0);
}
+namespace {
+class AllocationListenerWrapper : public AllocationListener {
+ public:
+ explicit AllocationListenerWrapper() {}
+
+ void set(AllocationListener* const delegate) {
+ if (delegate_ != nullptr) {
+ throw std::runtime_error("Invalid state");
+ }
+ delegate_ = delegate;
+ }
+
+ void allocationChanged(int64_t diff) override {
+ if (delegate_ == nullptr) {
Review Comment:
This method may be called before delegate_ is assigned , so add this check.
Stack:
```
gluten::(anonymous
namespace)::AllocationListenerWrapper::allocationChanged(long) (Unknown
Source:0)
libvelox.so!gluten::ListenableArbitrator::growCapacity(facebook::velox::memory::MemoryPool*,
unsigned long) (Unknown Source:0)
libvelox.so!facebook::velox::memory::MemoryManager::addRootPool(std::string
const&, long, std::unique_ptr<facebook::velox::memory::MemoryReclaimer,
std::default_delete<facebook::velox::memory::MemoryReclaimer> >) (Unknown
Source:0)
libvelox.so!gluten::VeloxMemoryManager::VeloxMemoryManager(std::unique_ptr<gluten::AllocationListener,
std::default_delete<gluten::AllocationListener> >) (Unknown Source:0)
std::thread::_State_impl<std::thread::_Invoker<std::tuple<gluten::MultiMemoryManagerTest_spill_Test::TestBody()::{lambda()#1}>
> >::_M_run() (Unknown Source:0)
libgluten.so!execute_native_thread_routine (Unknown Source:0)
libpthread.so.0!start_thread (Unknown Source:0)
libc.so.6!clone (Unknown Source:0)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]