> Here is a little more detail. I was able to trace it to this line:
> pDatas[TotalData]->recordNum = NumRecords+(multipleGameCounter/nCtrls);
> where pDatas is a structure containing a few things including the long
> recordNum, when it crashes, TotalData = 1195. pDatas is declared as:
> *pDatas[Max_Data] where Max_Data = 12000. The other numbers, NumRecords,
> multipleGameCounter, nCtrls are just integers where, in this case, the
> turns out to be 136.
> Hope this helps
> Jerry Evanoff
I would like to see the actual code (in particular your array
declaration). The explanation below being a wild guess, don't blame me
if I am way out.
My current guess is that you allocated an array of length Max_Data of
*pointers* to your (guessed name) TData struct type.
This means you allocated an array to store pointers to the records you
should have created somewhere else. Is it what you wanted to do? Since
you crash, I assume not and I assume you are using random valaues in the
array as pointers to your records. It crashed at that value, but it
could have crashed anywhere. ;-)
So, what you need to do is to declare your array as
TData pData[Max_Data]; if it is a static allocation
TData *pData; if it is dynamic allocation (within a routine), then
allocate your array in the heap with something like
pData = <dynamic_cast>(Ptr)NewPtrClear(Max_Data * sizeof(TData));
(Note that any allocation scheme like malloc would be fine here, I am
not debating this).
Note that you can't probably declare
TData pData[Max_Data] within a function, the compiler will likely tell
you that your stack allocation is larger than 32k, since your struct is
at least 4 bytes large and you have 12000 of them.
So, please let me know if my explanation has some relation with your
code. If not, I'll look at your code if you post it and apologize for
insulting you with too basic help ;-)