From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: not enough virtual memory using C++ constructor new' part II Date: Tue, 23 Jun 1998 22:54:08 -0400 Organization: Two pounds of chaos and a pinch of salt. Lines: 47 Message-ID: <35906A50.2D5B60A5@cs.com> References: <01bd9e89$5e630de0$0100a8c0 AT dismuntel DOT ctv DOT es> NNTP-Posting-Host: ppp122.cs.net Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Javier Calleja wrote: > > " I am using the command 'new' to allocate some variables in the memory. > The programm is written in C++ and it is compiled with gcc ver-2.80. But, > the 'not enough memory' appears in the screen when the program is executed. > > Why? When the 'new' action is executed, doesn´t it expand automatically > the heap ?" 'new' calls malloc() internally, which, as long as there is enough virtual memory remaining, should have no problems allocating it. Since go32-v2 shows that you have more than enough available memory, then the bug is likely somewhere else in your code. > I have received some e-mails where it's said what go32-v2 prints when it's > invoked. The answer is : > > DPMI memory available 64711 Kb > DPMI swap space available 130389 Kb. This indicates that you're running go32-v2 under plain DOS. Are you also running your program from plain DOS, or from a Windows 95 DOS shell? It makes a significant difference because Win95's builtin DPMI host handles DPMI memory differently than cwsdpmi.exe. You may need to look at the Memory tab of the MS-DOS Prompt properties sheet to make sure that DPMI memory is set to 65535 KB (you can type in a value manually). > I think I have enough space to work. I am allocating only 200 Kb with the > C++ constructor, and the programm works correctly in when it's compiled in > Borland environment under Win95. Please post some sample code that demonstrates the problem and is small enough for us to test ourselves. If you do have enough available memory, then the problem is most likely somewhere else. If you are unable to break a large program down sufficiently to be postable here (more than 100 lines or so), you can email it to me privately and I'll look at it. -- --------------------------------------------------------------------- | John M. Aldrich | "Sin lies only in hurting other | | aka Fighteer I | people unnecessarily. All other | | mailto:fighteer AT cs DOT com | 'sins' are invented nonsense." | | http://www.cs.com/fighteer | - Lazarus Long | ---------------------------------------------------------------------