• 2021.6
  • 04/11/2022
  • Public Content

Using Circular Buffers

Circular buffers can sometimes be used to minimize the overhead of allocating and freeing the items passed between pipeline filters. If the first filter to create an item and last filter to consume an item are both
, the items can be allocated and freed via a circular buffer of size at least
, where
is the first parameter to
. Under these conditions, no checking of whether an item is still in use is necessary.
The reason this works is that at most
items can be in flight, and items will be freed in the order that they were allocated. Hence by the time the circular buffer wraps around to reallocate an item, the item must have been freed from its previous use in the pipeline. If the first and last filter are
, then you have to keep track of which buffers are currently in use, because buffers might not be retired in the same order they were allocated.

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.