The errors are appropriate and will have saved you some sever debugging headaches by not allowing you to trash the stack. Local variables are stack based. You are putting 16,000 singles on the stack. Dims place either the value or a reference to a value on the stack frame for the scope of the method. Parameter declarations are also stack allocated.
Stack size is based on the runtime architecture and has almost nothing to do with GB's of RAM. Stacks are limited because they require contiguous, nonrelocatable space; you can't allocate RAM where the stack can grow into. Therefore, stack space will always be at a premium Regardless of the stack size allowed at runtime, use a memory block; the reference to it will be small and fit on the stack nicely and the size is limited only by available RAM. In fact, never put large structures on the stack, doing so limits recursion possibilities. Consider what happens if you pass realData by value; the original 64K of values plus a copy of the 64K of values as the passed parameter are pushing the stack further down. Pass a memory block reference and (a) you save the stack (b) the call is faster as there is no block move of 64K bytes to execute for the call. Gary On May 15, 2007, at 10:47 PM, Peter K. Stys wrote: > In a global module, I declared a structure with a few fields, one > of which is: > > realData(16000) as single > > When I compile I get 2 errors: > > 1) In my global.wtrkWave Declaration itself: "This method uses 125K of > stack space but the limit is 32K" > > 2) And in a function that declares a variable of type wtrkWave (as a > structure), I get the same error. > > First of all, how can a declaration (#1) use any stack space at all. > Second, my structure is 64K (16K singles give or take) not 125K, third > what's with the 32K limit on stack space anyway (in the days of the > Motorola 68000 chip I can understand that stacks were limited to 32K > on these 16 bit CPUs, but I have 2.5 GB RAM on my machine now and I > can't use more that 32K of stack???!!!!). > > What is going on here and how do I get around this? Having an array > of 16K singles is not asking for much. > > Thanks all, > Peter. > > > -- > ---------------------------------------------------------------------- > --------- > Peter K. Stys, MD > Professor of Medicine(Neurology), Senior Scientist > Ottawa Health Research Institute, Div. of Neuroscience > Ottawa Hospital / University of Ottawa > Ontario, CANADA > tel: (613)761-5444 > fax: (613)761-5330 > http://www.ohri.ca/profiles/stys.asp > ---------------------------------------------------------------------- > --------- > _______________________________________________ > Unsubscribe or switch delivery mode: > <http://www.realsoftware.com/support/listmanager/> > > Search the archives: > <http://support.realsoftware.com/listarchives/lists.html> _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
