Mail Archives: djgpp/1998/05/07/01:16:53
Martijn de Munnik wrote:
>
> I use the new operator to allocate mem for an object or simple type. Is it
> possible to allocate all my memory e.g. 48MB or are there some limits. If
> there are limits what sould I do to allocate more mem.
The limits imposed on how much memory you can allocate are determined
entirely by what DPMI provider your DJGPP programs run under. They are
also partly determined by the library malloc() code. For detailed
information and recommendations, please look in chapter 15 of the DJGPP
Frequently Asked Questions list, which specifically discusses memory
allocation. Here are some brief points:
- When running from Windows 3.1 or Windows 95, the largest amount of
DPMI memory you can make available to DOS programs is 64 MB (65535 KB).
However, Windows does not allow more than half of the total remaining
memory to be allocated at once.
- When running from plain DOS under cwsdpmi r4, you have access to up
to 256 MB of physical RAM and 256 MB of disk space, for a total of 512
MB. AFAIK, cwsdpmi does not limit the maximum size of an allocation.
- Other DPMI hosts may have other limitations; I'm not familiar with
them.
- DJGPP library malloc() rounds all memory requests up to the next
highest power of 2. So if you ask for 48 MB in one chunk, malloc()
actually tries to get 64 MB. Under anything but cwsdpmi, this is almost
guaranteed to fail.
See the FAQ for more recommendations.
--
---------------------------------------------------------------------
| John M. Aldrich | "Autocracy is based on the assumption|
| aka Fighteer I | that one man is wiser than a million |
| mailto:fighteer AT cs DOT com | men. Let's play that over again, |
| http://www.cs.com/fighteer | too. Who decides?" - Lazarus Long |
---------------------------------------------------------------------
- Raw text -