Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/ProducerConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,14 @@ ProducerConfig::ProducerConfig(const Napi::Object& producerConfig) : topic("") {
}
}

ProducerConfig::~ProducerConfig() {}
ProducerConfig::~ProducerConfig() {
// Release the persistent reference to the JS messageRouter callback. Without
// this, every producer created with a custom messageRouter pins the callback
// (and everything its closure captures) as a GC root for the lifetime of the
// process, long after the producer and its client are closed, leaking memory
// per closed producer. Reset() is a no-op when no router was configured.
messageRouter.Reset();
}

std::shared_ptr<pulsar_producer_configuration_t> ProducerConfig::GetCProducerConfig() {
return this->cProducerConfig;
Expand Down