i am using visual studio 2010.
i have a three dimensional structure array which, i think, gives me the wrong error.
The array is defined from
#define BUCKETS 2048
#define B_ENTRIES 4096
typedef struct fpinfo
{
unsigned long long offset;
unsigned long length;
char fing_print[33];
}fpinfo;
as
struct fpinfo search_buf[TNK_CACHE_SIZE][BUCKETS][B_ENTRIES];
The problem is,
when i define TNK_CACHE_SIZE to 6 it does not give me compile time error but have access violation error at run time when i try to write in to it.
on the other hand, if i define TNK_CACHE_SIZE to 3 it does give me the following compile time error.
1>LINK : fatal error LNK1248: image size (86CB7000) exceeds maximum
allowable size (80000000)
1) Why does it ignore the first declaration at compile time while it does not for the second one, when it was just half of the first one.
2) What is the maximum allowable size for a declaration on the stack?
3)Does this allowable size include all the other memory allocations in the project or is it one memory allocation after the other until there is no more allocable memory space and the last one not been able to be allocated flagged?
The compiler and linker’s check on the image size is probably imperfect. If you make it too big, probably some calculation has wrapped around resulting in an incorrect result which appears to be in the valid image size range. I.e. your toolchain will catch a small error in an image size going too big, but not a large error.
Note that if you double the number
86CB,7000, you get one that requires more than 32 bits to represent, namely1,0D96,E000. If the calculation is done in 32 bits, this might get chopped toD96,E000, making the image size look in range, though totally wrong.Try dynamically allocating the space with
malloc.