Run-time of function RingBuffer::ChangeCount(int numBuffers, DeviceUpdateMode mode)


Dear all,

the run-time of the function (int numBuffers, DeviceUpdateMode mode) with numBuffers = 10000 takes about 30 seconds. With higher numbers it the run-time increases in a linear way.

Any ideas how I can improve this or how the function can be called in a better way?
Has the run-time something todo with the camera or the equipment which is connected?



Well, that is quite a high number of buffers. Allocating that ammount of memory could take quite a while (depending on the size of the image you are setting the buffer for).

I’m assuming you need this high buffer count for a high speed video recording of some sort?


Ok, 30s is a bit much. However there are some scenarios where allocating can take a long time. Consider the following:

  • you are close to your systems maximum RAM - therefore you might see swapping effects
  • e.g switching from 9999 to 10000 will allocate 10000 buffers before freeing 9999 as a result you might come closer to your limit than expected.

When switching between high buffer numbers consider an additional step to reduce them first. So switch from 9999 to 3 (could be 1 but for some drivers 3 is the minimum) to 10000.