   Unhandled exception
  I'm getting an unhandled exception at this line:int* seedList = new int[nsize];nsize is only 15 so i don't think it could be not enough memory.   
  Maybe you are out of memory? :O   ;  Can we see the rest of that function - the line that precedes it, what nsize is, etc?Is this in debug or release? Do you know what kind of exception is thrown?   ;  whyyyy i have 4 gigs   ;  Oh maybe it is not enough memory, it's in a recursive function.  :(float World::getElev(int globX, int globZ, float hFac){srand(seedCoord(globX, globZ));int* seedList = new int[nsize];float* fList = new float[nsize];for (int i = 0; i < nsize; i++){seedList = rand();}for (int F = 0 ; F < nsize ; F++){int xmod = int(globX + pow(2.0, nsize-1))%int((size2plus1-1)/pow(2.0, F));int zmod = int(globZ + pow(2.0, nsize-1))%int((size2plus1-1)/pow(2.0, F));if ( xmod == zmod == 0 ){fList[F] = seedList[F] * hFac * pow (2.0, -F);continue;}int elevA = getElev(globX - xmod, globZ + ((size2plus1-1)/pow(2.0, F) - zmod),hFac);int elevB = getElev(globX + ((size2plus1-1)/pow(2.0, F) - xmod), globZ + ((size2plus1-1)/pow(2.0, F) - zmod),hFac);int elevC = getElev(globX - xmod, globZ - zmod, hFac);int elevD = getElev(globX + ((size2plus1-1)/pow(2.0, F) - xmod), globZ - zmod,hFac);fList[F] = ((xmod*(elevB-elevA)+xmod*(elevD-elevC))/2+ (zmod*(elevC-elevA)+zmod*(elevD-elevB))/2)/2;}float elevOut = 0;for (int i = 0; i < nsize; i++){elevOut += fList;}return elevOut;};  Does your program work for a while before this unhandled exception occurs?You're not deleteing any of those allocations, which means you're leaking (sizeof(int)+sizeof(float))*nsize bytes every call.Before return elevOut; you need to add:delete [] seedList;delete [] fList;or better yet, instead of this:int* seedList = new int[nsize];float* fList = new float[nsize];you could write:std::vector<int> seedList(nsize);std::vector<float> fList(nsize);which saves you the hassle of remembering to use delete at the end.   ;  I'll try the vector method.I added the deletes with no luck.The program gives the exception the first time this function is called.   ;  How is nsize defined?Without knowing the rest of the code, I have the suspicion that you get the error in the line int xmod = int(globX + pow(2.0, nsize-1))    %int((size2plus1-1)/pow(2.0, F));, where the second operand to the modulus might be zero, and you thus reap a division by zero.;  It's about 100 lines in total, is there a way to post it in a collapsable form?This part will skip the rest of the loop if xmod & zmod == 0 and return to the top for the next iteration, right?if ( xmod == zmod == 0 ){   fList[F] = seedList[F] * hFac * pow (2.0, -F);continue;};  Sorry, nsize is defined in the constructorWorld::World(float sizeIn, int secsizeIn){nsize = sizeIn;size2plus1 = pow(2.0, nsize)+1;secsize = secsizeIn;}my main func uses this call:World myWorld(15, 300);