Upon further investigation a mere allocation of orderArray = MK_SEG_PTR(void, DOSalloc(0x1000,2)); before the main dir code and deallocating it at the end without even using orderArray for sorting already corrupts things. I suspect that the memory block used for the message strings is getting in the way and may be out of bounds some where.
On Mon, 20 Aug 2018 at 22:23, Bart Oldeman <bartolde...@gmail.com> wrote: > > This change seems to be the cause (which was motivated by the fact > that otherwise with large memory model regular malloc's would fail as > they bumped into the allocated memory block) > --- a/cmd/dir.c > +++ b/cmd/dir.c > @@ -1010,7 +1010,8 @@ static int dir_list(int pathlen > error_out_of_memory(); > optO = 0; > } else { > - orderArray = MK_SEG_PTR(void, DOSalloc(0x1000,0)); > + /* use last-fit allocation to work well with large model */ > + orderArray = MK_SEG_PTR(void, DOSalloc(0x1000,2)); > if(!orderArray) { > free(orderIndex); > error_out_of_dos_memory(); > > if I change it back to 0 it's ok. The large memory model is only used > for debugging though ... I am still puzzled as to why last-fit > allocation seems to cause memory corruption (with small model here!) > and first-fit does not. > > Bart ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel