Skip to content

Segfault when creating many child nodes #2

@maarten-ic

Description

@maarten-ic

Hi @jholloc,

With the current master branch I frequently get bad_alloc exceptions and/or SEGFAULTS when initializing many child nodes on an HDC node.

Example program:

#include <hdc.hpp>
#include <iostream>

int main() {
    HDC hdc;
    for (int i=0; i<1024; i++ ) {
        std::string child_name = "Child#" + std::to_string(i);
        try {
            hdc.get_or_create(child_name);
        } catch (std::exception &ex) {
            std::cerr << "Caught exception '" << ex.what() << "' at i = " << i << std::endl;
            return 1;
        }
    }
    return 0;
}

When I compile and run this program on the master branch, this results in the program SEGFAULTing.

The last release (v0.21.0) doesn't have the same problem. After doing a git bisect, the issue seems to be this commit: 5fb812b

This commit touches a lot of logic, so I cannot pinpoint a likely cause..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions