Skip to content

core(alloc): force initialization of memalign flag#15701

Merged
opencv-pushbot merged 1 commit intoopencv:3.4from
alalek:issue_15691
Oct 16, 2019
Merged

core(alloc): force initialization of memalign flag#15701
opencv-pushbot merged 1 commit intoopencv:3.4from
alalek:issue_15691

Conversation

@alalek
Copy link
Copy Markdown
Member

@alalek alalek commented Oct 14, 2019

resolves #15691

  • before main() launch

relates #15544

@opencv-pushbot opencv-pushbot merged commit 823884b into opencv:3.4 Oct 16, 2019
@alalek alalek mentioned this pull request Oct 24, 2019
@mika-fischer
Copy link
Copy Markdown

@alalek We also ran into this issue.

I think this workaround is a bit clunky. The main problem is that isAlignedAllocationEnabled is not thread-safe.

Since c++11 is now required, you could simplify it to the following, which would make it thread-safe:

static inline
bool isAlignedAllocationEnabled()
{
    static bool useMemalign = readMemoryAlignmentParameter();
    return useMemalign;
}

Then you wouldn't need the g_force_initialization_memalign_flag variable anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants