Reputation: 2799
Hi I'm trying to use this:
std::tr1::array<std::tr1::array<queue<Graphnode>,MAXCPU>,MasterBufferNo> checkQueue;
But if the MasterBufferNo or MAXCPU is too large(MAXCPU = 4, MasterBufferNo=30000), there will be an running error:
=====================================================================================
= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
= EXIT CODE: 11
= CLEANING UP REMAINING PROCESSES
= YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
=====================================================================================
I wonder how to limit out? or what is the problem? I need a array much larger than that... the size of Graphnode is 32 bytes.
Thanks
Upvotes: 0
Views: 307
Reputation: 37930
std::array
is a wrapper around statically-sized C arrays. That means this data will be allocated on the stack. There is an upper bound on how large your stack allocations can be. So your best bet is to make this dynamically allocated via sdt::vector
.
One possibility:
std::vector<std::array<std::queue<Graphnode>,MAXCPU>> checkQueue(MasterBufferNo);
Upvotes: 1