Fixed-Size Large Byte Array in C++ #1025
-
If anyone can advise, I'd appreciate it. in C++
This carshes. Both Claud and GPT say near 3MB data cannot loan the empty space more than 1MB. Okay, the stack limit. What I found working is
or
Now, static may work but in practice, all the instances will share. So, my last option is iox:vector. However,
Due to my lacking c++ backgorund, i'm purely curious.. the iox::vector definition comes with the max size, why does it still need to be created like this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@ElliotHYLee In linux you have usually a stack size of around 8mb. If you add the C/C++ new (&sample.payload_mut()) ComplexDataType {}; You perform a placement new directly inside the shared memory, which is not the stack memory, and therefore it works. |
Beta Was this translation helpful? Give feedback.
@ElliotHYLee In linux you have usually a stack size of around 8mb. If you add the C/C++
static
keyword the variable is stored in the data segment and not the stack of the program. If you use theiox::vector
and construct it like this:new (&sample.payload_mut()) ComplexDataType {};
You perform a placement new directly inside the shared memory, which is not the stack memory, and therefore it works.