On 12/20/2012 3:11 PM, Ralf A. Quint wrote: > At 12:58 PM 12/20/2012, Louis Santillan wrote: >> The Memory Model (Tiny vs. Small vs. Compact vs. Medium vs. Large, >> .COM vs. .EXE) of the compiler could be causing the issue. Some >> compilers used to default to Small. What compiler flags are you using? > Even in the TINY model, there is no reason to get a stack overflow, > if the compiler indeed is not artificially limiting the stack size. > The sample program is using 8KB static data, 8KB+some slack for stack > and likely 2KB of code, as there is no output like printf. All well > below of the limit of 64KB. > SMALL and MEDIUM memory models only have static data and stack in the > same segment and separate 64KB for code, while COMPACT, LARGE and > HUGE (Borland only) even have their own 64KB stack segment... > > This should compile and run, regardless of the memory model... > > Ralf
Ah, but the compiler probably is creating some boundaries based on having to fit static variables, code, near heap and stack all in the same segment. This is a simple problem to fix. The Watcom linker guide has a discussion of the STACK= option. You can create a map file and look at it to see what the default is for your particular memory model. (They wisely did not publish the defaults, as they might change from release to release.) Mike ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ Freedos-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/freedos-user
