Cleanup of HdrHeap::HeapGuard and HdrStrHeap classes.#10961
Cleanup of HdrHeap::HeapGuard and HdrStrHeap classes.#10961ywkaras merged 2 commits intoapache:masterfrom
Conversation
| m_free_start += nbytes; | ||
| m_free_size -= nbytes; | ||
| if (_avail_size >= static_cast<unsigned>(nbytes)) { | ||
| char *new_space = reinterpret_cast<char *>(this) + _total_size - _avail_size; |
There was a problem hiding this comment.
I'd like to add a function that calculates this pointer with checking values.
There was a problem hiding this comment.
The checking is already present, on line 1181. It results in a nullptr return if the checking fails. The only place this function is called is in HdrHeap::allocate_str(), which does handle the null return value.
| case 2: | ||
| Warning("HdrHeap=%p coalescing twice", this); | ||
| break; | ||
| case 3: |
There was a problem hiding this comment.
Have you ever seen coalesce become more than 3?
There was a problem hiding this 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.
masaori335
left a comment
There was a problem hiding this comment.
It looks like just cleanups.
* Cleanup of HdrStrHeap class. * Encapsulate HdrHeap::HeapGuard.
No description provided.