Skip to content

the compilation time prompts: The object allocated on the heap may not be aligned 64 #159

Open

Description

@lovecomputer888

After using the following statement ReaderWriterQueue<int> q(100);
, the compilation time prompts: The object allocated on the heap may not be aligned 64, I use MSVC(ver2022,c++14) to develop, how to solve it?

Activity

  1. cameron314 commented on Jul 20, 2024

    @cameron314
    Owner

    Can you post the full error message?

  2. lovecomputer888 commented on Jul 20, 2024

    @lovecomputer888
    Author

    This code:dataQueue = new moodycamel::ReaderWriterQueue(1024);
    This is message: C4316 “moodycamel::ReaderWriterQueue<quint8,512>”: 在堆上分配的对象可能不是对齐 64

  3. kth8384 commented on Apr 11, 2025

    @kth8384

    I have the same warning when use std::make_shared to create a object of
    moodycamel::BlockingReaderWriterQueuestd::string , or use std::make_shared to create a object who has an attribute of moodycamel::BlockingReaderWriterQueuestd::string。

  4. cameron314 commented on Apr 11, 2025

    @cameron314
    Owner

    For objects allocated on the heap this can be normal. It's not a problem if the alignment to 64 is not respected, it's just a hint to potentially improve performance. You can define MOODYCAMEL_MAYBE_ALIGN_TO_CACHELINE before including the header to remove the alignment and silence this warning, if you like.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions