Xref: utzoo comp.lang.c:29420 comp.sys.ibm.pc:52055 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!usc!srhqla!orchard.la.locus.com!prodnet.la.locus.com!jta From: jta@locus.com (JT Anderson) Newsgroups: comp.lang.c,comp.sys.ibm.pc Subject: Re: MSC 6.0 malloc question Summary: Cannot allocate 64K using malloc in Micrsoft C Message-ID: <10254@oolong.la.locus.com> Date: 7 Jun 90 03:59:03 GMT References: <36163@sequent.UUCP> Followup-To: comp.sys.ibm.pc Distribution: usa Organization: Locus Computing Corp., Los Angeles Lines: 13 You cannot allocate 65535 bytes using malloc or its brethren in Microsoft C. The largest chunk you can allocate is somewhere in the neighborhood of 65520 bytes, and you can be sure the pointer will NOT have a 0 offset. If you need to allocate a full segment there are a couple of choices. You can use halloc, which will return a pointer with a zero offset under most circumstances. The offset will certainly be 0 if you pass a size parameter of 1. However, this is not guaranteed by the function definition. Another choice is to use the _dos_allocmem function. This function will provide you with a segment value, which you must use to construct a far pointer.