Mail Archives: djgpp/1996/11/05/19:49:25
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: <this space for rent> |
---------------------------------------------------------------------
- Raw text -