mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-23 15:10:34 +00:00
- Make it very unlikely that the allocation loop will ever need to run
more than once. Recover gracefully if it does.
- Prevent livelock by limiting the total possible number of iterations.
- If this ever happens, throw our metaphorical hands in the air, and
allocate under lock.
- Pad the size before allocating to give the cache a little room to grow
while not holding the lock.
- Pad by less on each iteration.
- Assert that no more than two iterations occur. Even two is probably
overkill, but this allows for rare edge case scenarios. e.g. The
cache is very small, the allocation takes a long time (which is
contradictory) and a handful of items get added, overcoming the
padding.