From: frenchc AT cadvision DOT com (Calvin French) Newsgroups: comp.os.msdos.djgpp Subject: Re: Large `new' request crashes: help! Date: Sun, 23 Feb 1997 12:23:42 GMT Organization: CADVision Development Corp. Lines: 19 Message-ID: <5eqksi$15gq@elmo.cadvision.com> References: <330ED369 DOT 4742 AT cssa DOT org DOT za> NNTP-Posting-Host: ts29ip55.cadvision.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Bruce Merry wrote: >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. Don't have an exacty answer for you, but Borlands compiler let you set a callback function that would get called whenever new failed. The function was called set_new_handler() I think. If new fails it should still return zero, so you could set_new_handler to a dummy function (or there is probably a better solution) and just test for a zero... - Calvin -