From: Bruce Merry Newsgroups: comp.os.msdos.djgpp Subject: Large `new' request crashes: help! Date: Sat, 22 Feb 1997 13:19:15 +0200 Organization: UUNET Internet Africa Lines: 18 Message-ID: <330ED369.4742@cssa.org.za> NNTP-Posting-Host: 196-7-124-74.iafrica.com 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 I've got an annoying problem. If I remember correctly (I've actually done not much C/C++, I'm a Pascal man) 'new' should return a NULL pointer if there is insufficient memory. I'm using DJGPP mostly for DPMI so that I can get loads of memory, but if I ask for too much my program just dies and says: Virtual memory exceeded in `new'. I want to be able to catch this properly. I'm prepared to overload the new operator if I have to, but I don't really want to. Also, how could I find out the largest allocatable block of memory? (This may be the solution to the previous problem). I've looked at DPMI.H and I've tried some stuff, but they don't seem to do what I want. One unrelated thing: How do you use assembly code in C++? I've written some Pascal stuff with embedded asm and I'd like to port it to speed things up. Thanks in advance Bruce Merry