Skip to content

Memory Allocation Issue with Aws::Crt::Io::EventLoopGroup (I guess) #338

@madhu-korada

Description

@madhu-korada

Confirm by changing [ ] to [x] below:

Platform/OS/Device
What are you running the SDK on?
Arm Debian platform

Describe the question
Standalone application basic_pub_sub is running fine on my device. But when I integrate it into my application I am facing this issue. On line Aws::Crt::Io::EventLoopGroup eventLoopGroup(1); I am facing the below issue.

Fatal error condition occurred in /home/linaro/madhu/sdk-cpp-workspace/aws-iot-device-sdk-cpp-v2/crt/aws-crt-cpp/crt/aws-c-common/source/allocator.c:128: allocator != ((void *)0)
Exiting Application
################################################################################
Stack trace:
################################################################################
Aborted

As I debugged further, I found that my standalone application is defaultly allocating memory (I guess), but my integrated application is not doing that. I added these prints in the EventLoopGroup.cpp file.

            EventLoopGroup::EventLoopGroup(uint16_t threadCount, Allocator *allocator) noexcept
                : m_eventLoopGroup(nullptr), m_lastError(AWS_ERROR_SUCCESS)
            {
                std::cout << "threadCount : " << threadCount << std::endl;
                std::cout << "allocator : " << allocator << std::endl;
                m_eventLoopGroup = aws_event_loop_group_new_default(allocator, threadCount, NULL);
                if (m_eventLoopGroup == nullptr)
                {
                    m_lastError = aws_last_error();
                }
            }

which is printing this in my standalone basic_pub_sub sample and working fine.

threadCount : 1
allocator : 0xaaaab5fd0fd8

but in my main application, it's printing this and crashing

threadCount : 1
allocator : 0
Fatal error condition occurred in /home/linaro/madhu/sdk-cpp-workspace/aws-iot-device-sdk-cpp-v2/crt/aws-crt-cpp/crt/aws-c-common/source/allocator.c:128: allocator != ((void *)0)
Exiting Application
################################################################################
Stack trace:
################################################################################
Aborted

Somehow it's not allocating the memory?? Or is it something else?? If so what can I do to allocate memory for it?? Or issue is something else??

Metadata

Metadata

Assignees

No one assigned

    Labels

    guidanceQuestion that needs advice or information.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions