Running C++ std::vector code on VxWorks - Memory access error - VxWorks
This is a discussion on Running C++ std::vector code on VxWorks - Memory access error - VxWorks ; Hi,
When I attempt to resize a column in a 2d vector I receive the error
listed below.
I'm using the libraries supplied with VxWorks.
0xf3fe450 (tExcTask): memPartFree: invalid block 0xf340ef0 in partition
0x311b8c
Here is the example code I'm ...
-
Running C++ std::vector code on VxWorks - Memory access error
Hi,
When I attempt to resize a column in a 2d vector I receive the error
listed below.
I'm using the libraries supplied with VxWorks.
0xf3fe450 (tExcTask): memPartFree: invalid block 0xf340ef0 in partition
0x311b8c
Here is the example code I'm using to produce the error. Any idea's what
is wrong with the code?
Daniel.
#include
using namespace std;
using std::vector;
int main (void)
{
std::vector< std::vector > triangle(5);
for(int i = 0; i < triangle.size(); i++)
{
triangle[i].resize(i+1);
}
}
-
Re: Running C++ std::vector code on VxWorks - Memory access error
Daniel J Watkins wrote:
> Hi,
>
> When I attempt to resize a column in a 2d vector I receive the error
> listed below.
>
> I'm using the libraries supplied with VxWorks.
>
> 0xf3fe450 (tExcTask): memPartFree: invalid block 0xf340ef0 in partition
> 0x311b8c
>
> Here is the example code I'm using to produce the error. Any idea's what
> is wrong with the code?
>
> Daniel.
>
> #include
>
> using namespace std;
> using std::vector;
>
> int main (void)
> {
> std::vector< std::vector > triangle(5);
>
> for(int i = 0; i < triangle.size(); i++)
> {
> triangle[i].resize(i+1);
> }
> }
I see nothing wrong (except maybe the redundant using clauses
). I
ran it on Solaris and it successfully completed. Must be a bug in your
STL implementation. Since it is a source library, I'd take a look had
how resize is implemented. Maybe it has a problem with resizing a 0
sized vector?
REH