Why the memory Limitation to a data structure in cpp: size of "XXX::C_SubNetwork::S_ListBuffer [3]" >= 256 Mb and can I raise the limit higher?
1 回表示 (過去 30 日間)
古いコメントを表示
How can I use more than 256Mb of memory for a data structure in cpp (visual studio)? Can I set the memory Limit to 1 GB of memory ?
The ERROR:
File C:\xxxxx\Source\TRUNK\aaaaa\Subnet.h line 550
Error: Limitation: size of "XXX::C_SubNetwork::S_ListBuffer [3]" >= 256 Mb
S_ListBuffer ms_DataBuffer[mu8BufferSize];
S_ListBuffer is a structure that is member variable.
0 件のコメント
回答 (1 件)
James Tursa
2020 年 7 月 21 日
編集済み: James Tursa
2020 年 7 月 21 日
This looks like you are declaring this variable as a local variable, in which case the memory for it will come off of the stack. The stack has a much smaller memory limit than the heap. You should allocate this variable from the heap with the new[] operator. (I.e., declare it as a pointer and assign it the result of a new[] operator). Be sure to delete[] it when you are done with it.
S_ListBuffer *ms_DataBuffer = new S_ListBuffer[mu8BufferSize];
:
delete[] ms_DataBuffer;
3 件のコメント
James Tursa
2020 年 7 月 21 日
編集済み: James Tursa
2020 年 7 月 21 日
I don't use Polyspace, so I have no idea how to increase the stack size and have "Polyspace follow." But, really, variables this size should be coming from the heap IMO.
Walter Roberson
2020 年 7 月 22 日
On some processors, stack-relative offsets are limited in the number of bits, because the offset is built in as part of the instruction.
参考
カテゴリ
Help Center および File Exchange で Run Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!