Hi,
I’ve encountered a code in a driver that for some reason (and let’s put this reason outside of this thread), initialize huge arrays in the code…
It is an inline function resides in header file (Let’s say imp.h) and function is called of course from a C file lets say called call.c, the function looks like:
(imp.h)
__inline void my_strange_func(int a, int b, int c, int d)
{
some code…
static const int Array1 = {0,1,…,64KB} ; // total size is 64KB elements in array
static const int Array1 = {0,1,…,64KB} ; // total size is 64KB elements in array
static const int Array1 = {0,1,…,64KB} ; // total size is 64KB elements in array
static const int Array1 = {0,1,…,64KB} ; // total size is 64KB elements in array
some code…
}
I know it is a strange code but let’s don’t deal with here, the question is the differences between checked/free builds
Now, when I compile this code in checked build environment, it takes me less than few seconds in order to compile & Link the code to a working .sys file!
When I run free environment (WDK 6000/DDK 3790.1830), It takes me a very long time (couple of minutes) to get the following error:
call.obj : error LNK2019: unresolved external symbol __chkstk referenced in function my_strange_func@16
than I replaced __inline with __forceinline
and than I got this error (again, after very long time):
imp.h(92) : error C1002: compiler is out of heap space in pass 2
The long time takes by cl.exe the use ~50% cpu and more than 500,000Kb of memory…
What I see in this meantime in the build window is “Compiling - generating code…”
Now, the questions:
-
why is the difference between checked and free builds? I would expect them to behave the same in this manner…
I just add that there are not #ifdef or something around this code…there are also no special definitions for DEBUG build (except the DBG define) -
my conclusion is that it is bad idea to put these very large arrays + not realistic idea - am I correct ?
Thanks !