[api] Eliminate rx_buf heap churn and release buffers after initial sync (#12133)

This commit is contained in:
J. Nick Koston authored and GitHub committed 2025-11-28 12:13:29 -06:00
1 parent 26e979d3d5
commit fb82362e9c
9 files changed
+44 -22

No files matched your search

+4 -2
View File
@@ -169,8 +169,7 @@ void APIConnection::loop() {
} else {
this->last_traffic_ = now;
// read a packet
this->read_message(buffer.data_len, buffer.type,
buffer.data_len > 0 ? &buffer.container[buffer.data_offset] : nullptr);
this->read_message(buffer.data_len, buffer.type, buffer.data);
if (this->flags_.remove)
return;
}
@@ -195,6 +194,9 @@ void APIConnection::loop() {
}
// Now that everything is sent, enable immediate sending for future state changes
this->flags_.should_try_send_immediately = true;
// Release excess memory from buffers that grew during initial sync
this->deferred_batch_.release_buffer();
this->helper_->release_buffers();
}
}