From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: allocating mem with new Date: Wed, 06 May 1998 18:39:49 -0400 Organization: Two pounds of chaos and a pinch of salt. Lines: 36 Message-ID: <3550E6B5.44E5@cs.com> References: NNTP-Posting-Host: ppp132.cs.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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 | ---------------------------------------------------------------------