G
gypsy3001
I inherited some code and got a segmentation fault on the following
line:
unsigned short localImage[panelRows * panelCols];
It's really baffling and I can't think of what could cause this
problem. The following are debug code I inserted:
cerr << "unsigned short size: " << sizeof (unsigned short) << endl;
cerr << "panelRows: " << panelRows << endl;
cerr << "panelCols: " << panelCols << endl;
cerr << "product: " << panelRows * panelCols << endl;
unsigned short localImage[panelRows * panelCols]; // what's the
problem?
cerr << "sizeof: " << sizeof (localImage) << endl;
DEBUG OUTPUT:
unsigned short size: 2
panelRows: 1024
panelCols: 1024
product: 1048576
Segmentation fault
STACK LIMIT DEBUG CODE:
struct rlimit limit;
getrlimit (RLIMIT_STACK, &limit);
cerr << "Soft Limit: " << limit.rlim_cur << endl;
cerr << "Hard Limit: " << limit.rlim_max << endl;
STACK LIMIT OUTPUT:
Soft Limit: 4294967295
Hard Limit: 4294967295
Anyone see anything obvious that my mind just can't focus on???
Chieh
line:
unsigned short localImage[panelRows * panelCols];
It's really baffling and I can't think of what could cause this
problem. The following are debug code I inserted:
cerr << "unsigned short size: " << sizeof (unsigned short) << endl;
cerr << "panelRows: " << panelRows << endl;
cerr << "panelCols: " << panelCols << endl;
cerr << "product: " << panelRows * panelCols << endl;
unsigned short localImage[panelRows * panelCols]; // what's the
problem?
cerr << "sizeof: " << sizeof (localImage) << endl;
DEBUG OUTPUT:
unsigned short size: 2
panelRows: 1024
panelCols: 1024
product: 1048576
Segmentation fault
STACK LIMIT DEBUG CODE:
struct rlimit limit;
getrlimit (RLIMIT_STACK, &limit);
cerr << "Soft Limit: " << limit.rlim_cur << endl;
cerr << "Hard Limit: " << limit.rlim_max << endl;
STACK LIMIT OUTPUT:
Soft Limit: 4294967295
Hard Limit: 4294967295
Anyone see anything obvious that my mind just can't focus on???
Chieh