   Strange program crash from directly from beginner examples.
  This is directly from examples I have found on internet. It is about loading heightmap and creating vertex array/indices from it.header terrain.h:   struct Terrain{    int numVertices;    Vector3f* vertices;   Vector3f* colors;   int numIndices;    unsigned int* indices;   int size;    int scale;    int patchSize;   Terrain(char* name, int t_size, int t_scale, int t_patchSize);    ~Terrain();   private:   bool loadTerrain(char* name, int t_size, int t_scale);   void calculateHeightfield(unsigned char* hmap);};The source file terrain.cpp:   #include <iostream>#include "terrain.h"using namespace std;Terrain::Terrain(char* filename, int tSize, int tScale, int tPatchSize){    this->size = tSize;    this->scale = tScale;    this->numVertices = size*size;    this->patchSize = tPatchSize;   // allocate memory for the vertices and clear the memory to 0    vertices = new Vector3f[numVertices];    //memset(vertices, 0, numVertices);    colors = new Vector3f[numVertices];    //memset(colors, 0, numVertices);   numIndices = ((patchSize+1) * 2 * patchSize) + (2*(patchSize-1));  indices = new unsigned int[numIndices];    memset(indices, 0, numIndices);   this->loadTerrain(filename, size, scale);}Terrain::~Terrain(){    cout << "Terrain dest"<< endl;    cout << "verts"<< endl;    delete [] vertices;    vertices = 0;    cout << "colors"<< endl;    delete [] colors;    colors = 0;   cout << "indices"<< endl;    delete [] indices;    cout << "Terrain dest"<< endl;    indices = 0;    cout << "Terrain dest"<< endl;    cout << "omg" << endl;   }bool Terrain::loadTerrain(char* filename, int tSize, int tScale){    FILE *fp;    // allocate some memory for the heightmap    unsigned char *hmap = new unsigned char[numVertices];    memset(hmap, 0, sizeof(unsigned char) * numVertices);    // clear the memory to 0    //memset(hmap, 0, size*size);    // open the heightmap file    if ((fp = fopen(filename, "rb")) == NULL)   return false;    // read in the heightmap into hmap    //fread(hmap, sizeof(unsigned char), size*size, fp);    fread(hmap, numVertices, sizeof(unsigned char), fp);    // we dont need the file anymore, so close it    fclose(fp);    // calculate the 3D heightfield    this->calculateHeightfield(hmap);    // we dont need the heightmap anymore, get rid of it    if (hmap!=0){   delete hmap;    hmap = 0;    }}void Terrain::calculateHeightfield(unsigned char *hmap){   Vector3f vert;    int curVertex=0;    // vertices    Vector3f temp;    for(int z = 0; z < size; z++){   for(int x = 0; x < size; x++){  int curVertex = (z*size)+x;temp.x = (float)x * scale;  temp.y = (float)(hmap[curVertex]*(scale/2));  temp.z = (float)z * scale;    vertices[curVertex] = temp;    temp.red = 0;  temp.green = ((float)hmap[curVertex] / 256.0f);  temp.blue = 0;  colors[curVertex] = temp;   }   }    //indices   int idx=0;    int x = 0;    int degenerate = 0;    for (int z = 0; z < patchSize; z++){   if(z % 2 == 0){  for (x = 0; x <= patchSize; x++) { indices[idx++]=z*size+x; indices[idx++]=(z+1)*size+x; degenerate= (z+1) * size + x;  }   } else {  for (x = patchSize; x>=0; x--) { indices[idx++]=(z+1)*size+x; indices[idx++]=z*size+x; degenerate = z*size+x;  }   } if((x + z*patchSize) >= (numIndices)){ break; } indices[idx++] = degenerate;   indices[idx++] = degenerate + size;   //cout << indices[i-1] << endl;    }}Now it crashes when the program exits, more specificly it crashes directly at the destruction indicises, even when there is just a bare program and nothing else. 
  Could anyone compile that and see if it crashes on him, too? ;  wtf, I just changed from unsigned int to unsigned short and it works wtf. ;  Some cards can take only 16-bit indices (short) as opposed to 32-bit (int).  ;  Oh, ok thats rad.. ^__^ 