From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp,gnu.gcc.help Subject: Re: max=32768 pointers? Date: Tue, 05 Nov 1996 18:36:22 -0800 Organization: Three pounds of chaos and a pinch of salt Lines: 30 Message-ID: <327FF9A5.1D0D@cs.com> References: <1996Nov5 DOT 154634 DOT 88493 AT cc DOT usu DOT edu> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp211.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: "DR TE$TH & THE ELECTRIC MAYHEM" To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp DR TE$TH & THE ELECTRIC MAYHEM wrote: > > I have heard that you cannot allocate 32,768+ pointers without first freeing > some of them. Is this true? If so, what is the cause? I could probably > figure a workaround if I knew what was stonewalling me. The DPMI host creates a handle for each block of memory you allocate within your program. When you allocate too many of these blocks, the host runs out of internal memory for the handles, and refuses to give you more (or crashes, depending on the version). At least, this is how CWSDPMI behaves; I'm not sure about Win31/95 etc. Workaround: Allocate the memory in chunks and write functions to parcel it out as needed. I have some sample code that you might find interesting if you want to follow this route. FYI, no program should ever require that many memory blocks - if you find yourself doing this, you need to think of better ways to manage your memory requirements. The absolute upper limit you should observe is no more than 200 or so separate allocations; any more and you're doing something badly wrong. l8r -- --------------------------------------------------------------------- | John M. Aldrich, aka Fighteer I | fighteer AT cs DOT com | | Plan: To find ANYONE willing to | http://www.cs.com/fighteer | | play Descent 2 on DWANGO! | Tagline: | ---------------------------------------------------------------------