Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!psuvax1!psuvm!cmh117 From: CMH117@psuvm.psu.edu (Charles Hannum) Newsgroups: comp.sys.ibm.pc Subject: Re: Need help with Turbo C "farmalloc" Message-ID: <90040.120159CMH117@PSUVM.BITNET> Date: 9 Feb 90 17:01:59 GMT References: <4100@mace.cc.purdue.edu> Organization: Penn State University Lines: 25 First off, farmalloc() calls DOS to allocate memory. This requires the memory you allocate to be rounded up to the nearest paragraph. In addition, an extra paragraph is added for the DOS "Memory Control Block". Together, this would eat up a huge chunk of memory if you allocate heap in such small bits. You could reduce this by using the more proper malloc() function, with the Large, Compact, or Huge memory models. In this case, Turbo-C keeps track of the allocation chain itself. However, each allocated segment would *still* require at least 12 bytes of extra header information. No matter what you do (even if you write your own), a generic malloc() routine will always require chaining information. This simply cannot be avoided. Perhaps you should take a better look at the problem you are trying to solve, and the algorithm you are trying to use. Modifying it will probably eliminate you malloc() woes altogether. Virtually, - Charles Martin Hannum II "Klein bottle for sale ... inquire within." (That's Charles to you!) "To life immortal!" cmh117@psuvm.{bitnet,psu.edu} "No noozzzz izzz netzzzsnoozzzzz..." c9h@psuecl.{bitnet,psu.edu} "Mem'ry, all alone in the moonlight ..."