Search code examples
azure-iot-sdk

azure-iot-sdk-c - using the Azure IoT device SDK C in pure statically allocated memory environments


is it possible to use the Azure IoT device SDK C in an environment, in which only static allocation of RAM is allowed (no malloc/free)?

Best

Fabian


Solution

  • The azure-iot-sdk-c was not designed with statically allocated memory in mind, and out of the box the SDK will allocate memory dynamically. With that said, with a little coding there is a way to achieve similar functionality. In the sdk there is an interface header named gballoc.h in the c-utility include folder.

    By default all allocations go through malloc and free, but if the symbol GB_USE_CUSTOM_HEAP is defined, all allocation will go through this interface. You can setup a custom memory allocation scheme to handle memory allocations any way you choose.

    Hope this helps.