2D Array Memory Allocation Crash in C -


i seem having problems memory allocation 2d array using calloc.

when allocating 2nd dimension array calloc crashes when outside ide standalone executable, works when debugging. i've gone though can think of , stumped why happens; when working fine couple of days ago. seems spontaneous malfunction won't stop.

the code in seperate function of called multiple times.

o = (double**)calloc(3*cc,sizeof(double*)); (r = 0; r < 3*cc; r++){     printf("row: %d ",r);     printf("1.addy: %p ",&o[r]);     o[r] = (double*)calloc(4,sizeof(double));     printf("2.addy: %p\n",&o[r]); } 

i've tried using different forms of freeing memory:

for (r = 0; r < 3*c; r++)         free(o[r]); 

&

free(o); 

but crash @ different points. when memory not freed.

this screenshot of memory addresses allocates during each call , appear freed , reused appropriately, crash. if can tell me what's going on best.

memory locations


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -