Hi All,
I have a TNS C code as below and it is going to dynamically create a
long array with 87666218 times. Afterwards, it will put the sequential
integers into such array. the creation code "seq_array=(unsigned long
*)malloc(sizeof(unsigned long)*units_a);" can be passed and the
seq_array = 0. Afterwards, executing "seq_array[i]=1+i;", when i =
2887, the whole process will be aborted with below error. I know this
error is because the pointer corrupted the MCB pointer G[0] but I
don't know how to sovle it. Everytime the dynamically array creation
will give the initial address 0 to seq_array. The run-time env is
Operating System H06, Release H06.25.00. Please advise. Thank you so
much.
\P3DEV.$:0:931:
3647952864 - *** Run-time Error 013 ***
\P3DEV.$:0:931:
3647952864 - MCB pointer corrupt (%0)
\P3DEV.$:0:931:
3647952864 - From INITIALIZESEQ + %30, UC.00
#pragma refaligned 2
#pragma page
#pragma strict
#pragma symbols, inspect, saveabend, save
#pragma heap 32 pages
#pragma wide
#pragma highpin
#pragma env common
#pragma xmem
#pragma extensions
#include "=SYSHDR^S_STDIOH"
#include "=SYSHDR^S_STDLIBH"
#include "=SYSHDR^S_STRINGH"
#include "=SYSHDR^S_MATHH"
#include "=SYSHDR^S_TIMEH"
#include "=SYSHDR^S_ERRNOH"
#define fixedArraySize 1000
static unsigned long *seq_array;
int INITIALIZESEQ(unsigned long buffer[],unsigned long
units_a,unsigned long units_b,
unsigned long loop_control);
int INITIALIZESEQ(unsigned long buffer[],unsigned long
units_a,unsigned long units_b,
unsigned long loop_control)
{
unsigned long i,reply_code;
reply_code = 0;
if (loop_control == 0)
{
seq_array=(unsigned long *)malloc(sizeof(unsigned
long)*units_a);
for (i=0; i< units_a; i++)
seq_array[i]=1+i;
}
return 0;
}
int main()
{
unsigned long i,result,units_a,units_b;
unsigned long p[fixedArraySize*5];
i=0;
units_a = 87666218;
units_b = 555555;
result = INITIALIZESEQ (p,units_a,units_b,i);
return 0;
}
Thanks
Andy