I found the bad code. While your example works, if I change it to use calloc (which is what my code is using at the particular failure point), then it fails. Looks like calloc is doing something funny.
Happy Hacking, David E. McMackins II Supporting Member, Electronic Frontier Foundation (#2296972) Associate Member, Free Software Foundation (#12889) www.mcmackins.org www.delwink.com www.eff.org www.gnu.org www.fsf.org On 07/28/2018 12:31 PM, Mateusz Viste wrote: > On Sat, 28 Jul 2018 11:49:42 -0500, David McMackins wrote: >> Is there a way to allocate a buffer in OpenWatcom that is larger than >> 64k? > > Sure. Either use XMS/EMS, or rely on the "huge model" kludge. > >> I'm currently trying to stay within the compact memory model, but >> even if I compile for huge memory model, I'm getting an out of memory >> error for trying to allocate about 80k for a buffer. > > Either your code is bad or you truly do not have any available block of > 80K contiguous conventional RAM. > > I tested it right now with the code below, and it works as expected > (prints "success!"): > > /* compile: wcl -0 -mh -os -lr test.c */ > #include <stdio.h> > #include <stdlib.h> > > int main(void) { > char *buf; > buf = malloc(81920l); > if (buf == NULL) { > printf("oops\n"); > } else { > buf[80000l] = '!'; > buf[80001l] = 0; > printf("success%s\n", buf + 80000l); > free(buf); > } > return(0); > } > >> My machine has 128M >> of memory, so I'm not actually running out of memory. > > That is irrelevant, since we are talking conventional memory here. > >> This code works >> fine under DJGPP, so I know my hardware is capable. > > Apples and oranges. DJGPP is protected mode, while you are using real > mode. > > Mateusz > ------------------------------------------------------------------------------ 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