Page 1 of 1

High memory usage on DeckLink SDK 10.8

PostPosted: Wed Apr 19, 2017 8:36 am
by LarsWesselius
Hi,

Been profiling my application using DeckLinkInput and DeckLinkOutput at the same time, and it seems that the DeckLinkAPI is using 500-700mb of memory in my application. This is a C# application, and the memory is shown under the DeckLinkAPI module as unmanaged memory (which obviously makes sense).

Can anyone tell me why the DeckLink API would be taking so much memory? Is it my code, or DeckLink itself? Anything I can try to reduce it?

Edit: I've figured out that it's specifically a DeckLinkInput where I'm ignoring the video frames and just using the audio samples.

Re: High memory usage on DeckLink SDK 10.8

PostPosted: Wed May 17, 2017 5:41 am
by Waqqas Sharif
Hello Lars,

The described memory usage pattern is indeed expected when using the default allocator (e.g. used by the Capture sample).

The DeckLink API will by default allocate a buffer sufficient for approximately 1 second of video frames in the largest video mode / pixel format combination.

This memory is then partitioned to create the video frame buffers in other video modes.

It should be possible to reduce the amount of memory allocated by implementing a custom IDeckLinkMemoryAllocator which rejects allocation attempts beyond some application defined limit.

To implement a custom allocator, implement the IDeckLinkMemoryAllocator[1] interface, and pass an instance of your allocator to the IDeckLinkOutput::SetVideoOutputFrameMemoryAllocator[2] method which will replace the default allocator with your custom instance.

Regards
Waqqas

[1] 2.5.18 IDeckLinkMemoryAllocator Interface
[2] 2.5.3.7 IDeckLinkOutput::SetVideoOutputFrameMemoryAllocator method