Hi Guys
I just downloaded he Bcc32 complier from Borland, Installed and set up the default option in the readme file
Then I got down to some coding
I have the complier running on Windows 2000 platform and running it under the command prompt nothing unusual I hope
The problem I seem to have is when I generate a large array using a for loop and process the data I can only use a small array ie 100 100 10 when I increase the size I get a program error and an error log has been generated (cant find where this is stored)
When I run a "mem" on my system I have 1MB total contiguous extended memory and 0 MB (zero) byte available contiguous extended memory (see attachment)
Can n e one shed some light on this I can see where I can go from here as DOS windows doesn?t allow you to increase memory
I've also tried using malloc() function to set the memory but i still get the same error(crash)
Here is the code using the malloc () function
Code:/*Snippet of code creates a 3D array*/ //Working version better that datacamera #include "stdlib.h" #include "stdio.h" #include "math.h" #include "time.h" #include "windows.h" /* Defining the dimension of the datacamera array*/ #define NoOfFrames 20 #define XDim 500 // this means X rows #define YDim 500 // this means Y rows #define size 2 #define index 0 main() { //printf("No Problem"); /*Initialisng the LOOP values x y and FrameNoDepth coordinates for the array*/ int i, j, FrameNoDepth,numberint; double number; int StartCount,EndCount,ResultCount; printf("No Problem"); // Defines the datacamera array NOTE change to the datacamera that appears within the FOR loop int *datacamera [NoOfFrames] [XDim] [YDim]; int *TotalDiff [size] [XDim] [XDim]; int *Diff [size] [XDim] [XDim]; datacamera [NoOfFrames] [XDim] [YDim] = malloc(2000000); TotalDiff [size] [XDim] [XDim] = malloc(2000000); Diff [size] [XDim] [XDim] = malloc(2000000); if (!datacamera){ printf("Allocation Error"); exit(1); } if (!TotalDiff){ printf("Allocation Error"); exit(1); } if (!Diff){ printf("Allocation Error"); exit(1); } //*********************************************************** //* Code to View GENERATE DATA * //*********************************************************** for (FrameNoDepth=0;FrameNoDepth<=(NoOfFrames-1);FrameNoDepth++){ for (i=0;i<=(XDim-1);i++){ // rows defined first for (j=0;j<=(YDim-1);j++){ // then coloums if (FrameNoDepth==0){ datacamera[FrameNoDepth][i][j] = 0; } else{ *datacamera[FrameNoDepth][i][j] = i; } }/*end j for loop*/ }/*end i for loop*/ } /*end FrameNoDepth for loop*/ // initialise SUM of DIFFERENCE array for (i=0;i<=(XDim-1);i++){ // rows defined first for (j=0;j<=(YDim-1);j++){ // then coloums TotalDiff[index][i][j] = 0; }/*end j for loop*/ }/*end i for loop*/ // initialise SUM of DIFFERENCE array for (i=0;i<=(XDim-1);i++){ // rows defined first for (j=0;j<=(YDim-1);j++){ // then coloums Diff[index][i][j] = 0; }/*end j for loop*/ }/*end i for loop*/ //*********************************************************** //* Code to View ANALYSE * //*********************************************************** // Code to start the clock StartCount = GetTickCount(); for (FrameNoDepth=0;FrameNoDepth<=(NoOfFrames-1);FrameNoDepth++){ for (i=0;i<=(XDim-1);i++){ // rows defined first for (j=0;j<=(YDim-1);j++){ // then coloums //Line below calculate the difference using the first image in the array index=0 *Diff[index][i][j] = abs(*datacamera[index][i][j]-*datacamera[FrameNoDepth][i][j]); *TotalDiff[index][i][j] = *TotalDiff[index][i][j] + *Diff[index][i][j]; }/*end j for loop*/ }/*end i for loop*/ } /*end FrameNoDepth for loop*/ EndCount = GetTickCount(); //*********************************************************** //* Code to View DATA * //*********************************************************** printf("--------------- \n"); printf("\n"); ResultCount = EndCount-StartCount; printf("Count, %d",ResultCount); //Free up memory location free (datacamera); free (TotalDiff); free (Diff); return 0; }



LinkBack URL
About LinkBacks


