   Deciphering 5 year-old code
  Ever had to go through someone else''s source to fix a problem or change this or that.  Well, it sucks.  All I have to do is create a file-convertor for our old files(weird type, better not too explain).  Well the last developer was a C programmer(hence the recent questions about C) and he didn''t like to use anything but regular arrays even for huge amounts of data.  Well anyways i''m trying to convert this file format to mine(mine: 9k, his way: 864K, weird, eh?) using a console mode program and just adding it to the shell menu.  Long story somewhat shorter, I can''t create an array the nessecary size (lol, 12, 7, 4096).  It just crashes instantly. Is there a way i can change the memory model for console programs or somehow got an idea for a loophole( the struct is pretty small, 4 dwords ).Thanks,Robert WardenLasershot Shooting Simulations
  In an console app you have access to all the ram, so the problem isn''t with the allocation... probably something else that''s messing it up.I could take a look at it if you want.just mail it to: torbjorn.gyllebring@telia.com  ;  Well i know the exact line it crashes at......   Frame Frames[12][4][4096];  where a Frames is.............   struct Frame{    DWORDFlag;    DWORDx;    DWORDy;    DWORDz;};  If i comment the declaration it runs if not it crashes, but i can still send you the code if you like.    Robert WardenLasershot Shooting Simulations;  I think you are blowing you stack: use new to allocate memory from the heap. Frame*** frame = new Frame**[12];for( int i = 0; i < 12; i++ ){   frame = new Frame*[4];   for( int j = 0; j < 4; j++)  { Frame[j] = new Frame[4096];<br>  }<br>}<br><br><br>  </i>   ;  Definitely blowing the stack.  Furthermore, instead of doing all those dynamic allocations (12x4x4096 = ~200k!) of a 16-byte structure, do it in a couple of blocks or even one big block, then wrap it with a class or something to do the dereferencing yourself.  I''d suggest splitting it up to maybe 48 blocks (12x4) of 4096 dynamically-allocated arrays, making each chunk of memory 4096 x 16 = 65kbytes per block, perfectly reasonable.  Or you could just do it all at once (3 megs), depends on your target platform really.  