Fabian
Fabian

Reputation: 23

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

Upvotes: 1

Views: 214

Answers (2)

Jelani Brandon
Jelani Brandon

Reputation: 26

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.

Upvotes: 1

Michael Xu
Michael Xu

Reputation: 4432

I don't believe azure-iot-sdk-c could be used in an environment which only static allocation is allowed in.

The Azure IoT device SDK for C is written in ANSI C (C99) to maximize portability. This feature makes the libraries well-suited to operate on multiple platforms and devices, especially where minimizing disk and memory footprint is a priority. Memory footprint includes Dynamic allocations(including heap/VA).

Upvotes: 0

Related Questions