c++amazon-web-servicesaws-sdk-cpp

What is the purpose of the "allocationTag" parameter in the AWS SDK for C++?


The AWS memory allocation functions, Aws::MakeShared, Aws::MakeUnique, Aws::MakeUniqueArray, Aws::Malloc, Aws::New, and Aws::NewArray all require a const char * allocationTag argument to be provided, however, it's unclear exactly what this string is used for.

The AWS SDK for C++ documentation on Aws::MakeShared says:

"...allocationTag is for memory tracking purposes."

But how exactly is allocationTag being used for memory tracking? Is there a guideline for what allocationTags values to use with the AWS memory management functions?


Solution

  • I just stumbled across the answer to this on the "Q&A" section of the GitHub repo.

    https://github.com/aws/aws-sdk-cpp/discussions/2031

    TLDR: It's a special tag that is used to track allocations, it will be logged if your API configuration allows it.