Xref: utzoo comp.lang.c:29345 comp.sys.ibm.pc:51873 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!usc!srhqla!demott!kdq From: kdq@demott.COM (Kevin D. Quitt) Newsgroups: comp.lang.c,comp.sys.ibm.pc Subject: Re: MSC 6.0 malloc question Message-ID: <278@demott.COM> Date: 5 Jun 90 00:44:37 GMT References: <36163@sequent.UUCP> Reply-To: kdq@demott.COM (Kevin D. Quitt) Followup-To: comp.lang.c Distribution: usa Organization: DeMott Electronics Co., Van Nuys CA Lines: 45 In article <36163@sequent.UUCP> brett@sequent.UUCP (Brett Leichner) writes: > >I'm writing a part C/part assembly routine that needs to be able to allocate and >use a full segment (65535 bytes). Here are the specifics: > >The problem is that if "num_bytes" is greater than about 65550 then _fmalloc >returns null trying to allocate the first buffer. >1. Does DOS use these extra bytes for house-keeping? When DOS allocates memory, it requires 1 paragraph (16 bytes out of your 63356 (not 65535) bytes. >2. Is it possible to allocate all 65535 bytes of a segment for use? (dynamic > allocation only). Yes - declare your pointer as huge or use the huge model to compile >3. If DOS needs some of the memory for house-keeping, is it possible to > use the huge model, and allocate say 66000 bytes in such a way that the > house-keeping stuff will be pushed over into another segment thereby > giving me at least one full segment? Every paragraph in DOS starts a new segment, so the DOS house-keeping will be at NNNm:0 and your memory will be at NNNn:0 where n = m + 1 >4. On a side note, using the hugh model and declaring arrays that span multiple > segments is there a way to guarantee that the array will be composed of > segments physically adjacent? It shouldn't matter in the huge model - the compiler does all the extra work for you. (can you say slow? I knew you could). -- _ Kevin D. Quitt Manager, Software Development 34 12 N 118 27 W DeMott Electronics Co. 14707 Keswick St. Van Nuys, CA 91405-1266 VOICE (818) 988-4975 FAX (818) 997-1190 MODEM (818) 997-4496 Telebit PEP last demott!kdq kdq@demott.com 96.37% of the statistics used in arguments are made up.