Search code examples
iosipadopengl-esobjective-c++

Error switching from vector<float> to vector<short>


I have an app I'm making where I would like to change a vector I'm creating from float to short. My code is in a header file like this:

vector<float> vertices;

and it works fine, but if I switch it to this:

vector<short> vertices;

and compile, it crashes with the following error:

malloc: *** error for object 0x1035804: incorrect checksum for freed object
 - object was probably modified after being freed. *** set a breakpoint in
malloc_error_break to debug

I have no idea what's going on. If it helps, this is an OpenGL application I'm developing for the iPad.


Solution

  • I still don't know why my app wouldn't run when I changed my vector from float to short, but I solved the problem by creating a new vector object of shorts and using that instead. No more problems and works as expected.