techyian / MMALSharp

C# wrapper to Broadcom's MMAL with an API to the Raspberry Pi camera.
MIT License
195 stars 33 forks source link

List<byte> initial size #182

Open MV10 opened 3 years ago

MV10 commented 3 years ago

The library uses List<byte> buffers and I believe the List<T> default constructor only allocates enough space for 10 entries. Given the size of MMAL buffers and camera frames, we should investigate whether there is any benefit to allocating a much larger size in the constructor.

Edit: Additionally, the default behavior is to double the capacity each time the limit is reached. Each list potentially allocates up to twice as much memory as it actually needs.