ywkaras commented on code in PR #10961:
URL: https://github.com/apache/trafficserver/pull/10961#discussion_r1446555228
##########
src/proxy/hdrs/HdrHeap.cc:
##########
@@ -241,39 +240,50 @@ HdrHeap::allocate_str(int nbytes)
// but I already no that this code path is
// safe for forcing a str coalesce so I'm doing
// it here for sanity's sake
- if (m_lost_string_space > static_cast<int>(MAX_LOST_STR_SPACE)) {
- goto FAILED;
- }
+ int coalesce = m_lost_string_space > static_cast<int>(MAX_LOST_STR_SPACE) ?
1 : 0;
-RETRY:
- // First check to see if we have a read/write
- // string heap
- if (!m_read_write_heap) {
- int next_size = (last_size * 2) - sizeof(HdrStrHeap);
- next_size = next_size > nbytes ? next_size : nbytes;
- m_read_write_heap = new_HdrStrHeap(next_size);
- }
- // Try to allocate of our read/write string heap
- new_space = m_read_write_heap->allocate(nbytes);
+ for (;;) {
+ if (coalesce) {
+ switch (coalesce) {
+ case 2:
+ Warning("HdrHeap=%p coalescing twice", this);
+ break;
+ case 3:
Review Comment:
No. The original code allowed coalescing to be repeated an unlimited number
of times. I think it should only happen once, but I'm not 100% sure, so I
didn' t want to add assert to check it. If we see coalescing happening
repeatedly, we should try to figure out if it make sense for that to happen.
--
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]