Mail Archives: djgpp/1997/09/28/01:48:16
> my program as soon as I dereference a byte above segment limit
> (obtained from ___dpmi_get_segment_limit(...)). But this does
> not happen! It is only when I dereference 64K *above* the stated
> segment limit that my program trashes. What is happening here?
You get the limit.
You call printf, which internally allocates memory, which calls sbrk,
which increases the memory from DPMI and increases the limit 64K.
You try to touch the memory, which is now valid after the print.
Change the order of your calls. Put a print statement first, then
get the limit AFTER the print statement, and try it.
- Raw text -