Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!usc!polyslo!ttwang From: ttwang@polyslo.CalPoly.EDU (Thomas Wang) Newsgroups: comp.lang.c++ Subject: proper behavior of operator new Message-ID: <14208@polyslo.CalPoly.EDU> Date: 4 Sep 89 16:45:19 GMT Reply-To: ttwang@polyslo.CalPoly.EDU (Thomas Wang) Distribution: usa Organization: Cal Poly State University -- San Luis Obispo Lines: 18 When memory on the free store runs out, operator 'new' will call the function pointed by _new_handler. When _new_handler finishes, I think the new operator should try another time to allocate the storage. This is because the _new_handler may have deleted some unused storage space, so now there is enough space after all. On page 93 of "The C++ Programming Language", Bjarne suggested we re-define the 'new' operator. I don't think this is practical. Re-defining the 'new' operator is difficult, and non-portable across systems. I raised this issue, because the _new_handler can be used to do garbage collection. Right now, even after garbage collection, the new operator will still return a null pointer. -Thomas Wang ("I am, therefore I am." - Akira ) ttwang@polyslo.calpoly.edu