I have a program which sends and receives messages over TCP/IP.
Originally the message size was 8K and it worked fine. The
message size has been changed to 16K. The program is compiled
-ms switch for a 16-bit small model and it compiles without
errors.
However, when the program is running, I get the error:
Stack Overflow at 0005:0000CF46
and the program halts.
Have I encountered a limitation in the memory model or possibly
the 16 bit addressing? Should I try other memory models? Can
program with different memory models co-exist? And lastly,
is there any hardware reasons for keeping the 16-bit small
memory model (I am running on an RTP6800 single board computer
from RTP Corp.)
In small model ‘-ms’ the data segment is limited to 64K total. If you must
use small model, try playing with the stack size ‘-n#’. I believe that if
you decrease it a little you may have room for the TCP/IP buffer which it is
trying to allocate on the heap, which is also in the data segment.
However, the best solution is to compile and link in flat model ‘-mf’. But,
if you do, all modules must be compiled and linked in flat model.
I have a program which sends and receives messages over TCP/IP.
Originally the message size was 8K and it worked fine. The
message size has been changed to 16K. The program is compiled
-ms switch for a 16-bit small model and it compiles without
errors.
However, when the program is running, I get the error:
Stack Overflow at 0005:0000CF46
and the program halts.
Have I encountered a limitation in the memory model or possibly
the 16 bit addressing? Should I try other memory models? Can
program with different memory models co-exist? And lastly,
is there any hardware reasons for keeping the 16-bit small
memory model (I am running on an RTP6800 single board computer
from RTP Corp.)
I have a program which sends and receives messages over TCP/IP.
Originally the message size was 8K and it worked fine. The
message size has been changed to 16K. The program is compiled
-ms switch for a 16-bit small model and it compiles without
errors.
“-ms” doesn’t give you 16 bit small model “-2 -ms” does.
However, when the program is running, I get the error:
Stack Overflow at 0005:0000CF46
and the program halts.
Have I encountered a limitation in the memory model or possibly
the 16 bit addressing? Should I try other memory models? Can
program with different memory models co-exist? And lastly,
is there any hardware reasons for keeping the 16-bit small
memory model (I am running on an RTP6800 single board computer
from RTP Corp.)
I have a program which sends and receives messages over TCP/IP.
Originally the message size was 8K and it worked fine. The
message size has been changed to 16K. The program is compiled
-ms switch for a 16-bit small model and it compiles without
errors.
Are you sure you’re compiling 16-bit small? That would
require -ms -2. Even if you are, do you really want to?
16-bit small model limits you to 64K of code, and 64K of
data, with the stack in the data segment. If you increase
the space you’ve used for data, then you decrease the space
available for stack, and that is likely to be why you’re
overflowing your stack.
Your best choice would be to change models – most TCP/IP code
expects to be run in 32-bit, in which case we generally suggest
compiling -ms and linking -mf. If you must stay in 16-bit, then
I would suggest either large model (-ml) or whichever of medium
or compact (-mm, -mc) allows 64k and more than 64k of data.
(I forget which is which, one allows a single segment for code,
and multiple for data; while the other allows multiple code
segments but only one data segment.)