| T O P I C R E V I E W |
| Voostra |
Posted - 03/29/2005 : 1:15:29 PM So, I seem to be getting a memory problem... Not sure what might cause it -
So far, the program opens a file, and scan through it taking some values out, copying them to a worksheet, then closes the stream. It then takes the min and max of a couple columns, and uses a GetN prompt to ask for some other values. Then, it generates a matrix to put the values into, and sizes it according to some of the input parameters. (Hadn't had any problems up to here).
I then wanted to 'zero' the matrix, so I put in a command to do this, and now I'm getting memory error messages:
"Can not allocate any more memory for _!_XB_N"
The last bit of the code regarding the matrix is here:
MatrixPage mp; mp.Create("origin"); string newPageName3 = "data matrix"; PageBase pg3 = Project.Pages(); pg3.Rename(newPageName3); MatrixLayer mly = mp.Layers(0); Matrix matA(mly); ////properly dimension the matrix mly.SetNumRows(matrixScanStep); mly.SetNumCols(matrixMzStep); matA.SetYMin(matrixScanMin); matA.SetYMax(matrixScanMax); matA.SetXMin(matrixMzMin); matA.SetXMax(matrixMzMax);
matA = 0; //didn't have any problem until I put this in....
I'm suspicious I screwed up with the file opening closing somewhere, and it is sucking memory somehow, This is how I opened and closed the file:
string fileName = GetOpenBox("*.*"); // select a file to open if( fileName.IsEmpty() ) { out_str("No file was selected!"); return; } FILE *stream; stream = fopen(fileName, "r" ); //open the file
//then,
while( !feof( stream ) ) { if( fgets( line, 50, stream ) == NULL) //exit else process the input lines } fclose( stream );
is there anything there I've buggered up?
If anyone can see where I might have goofed, it would be great! I don't think it a problem with the data I'm processing - I'm writing it to work on large data files (1000's of point), but I'm testing it on a much smaller test data set of only ~20 points.
Thanks Evan
|
| 1 L A T E S T R E P L I E S (Newest First) |
| Voostra |
Posted - 03/29/2005 : 1:52:36 PM Thanks for putting up with me - I'm learning, slowly but surely...
I think I got it fixed - I think the problem was arising because I was trying to change all the values in a matrix of unspecified size (probably lots of values...)
I moved the mly.SetNumRows(matrixScanStep); mly.SetNumCols(matrixMzStep);
commands so they came after the MatrixLayer had been defined, but before I created the Matrix matA based on that layer, and it seems to have worked...
Does that make sense?
Edited by - Voostra on 03/29/2005 1:53:27 PM |
|
|