home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!timbuk.cray.com!hemlock.cray.com!dsf
- From: dsf@cray.com (Dan Frankowski)
- Subject: Re: help?? is their a method for solving dynamic allocation problemes in c++
- Message-ID: <1992Aug27.105627.14031@hemlock.cray.com>
- Lines: 43
- Organization: Cray Research, Inc.
- References: <1992Aug19.203838.20501@bmw.mayo.edu> <78304@ut-emx.uucp> <1992Aug27.092938.6768@hemlock.cray.com>
- Date: 27 Aug 92 10:56:27 CDT
-
- In article <1992Aug27.092938.6768@hemlock.cray.com> dsf@cray.com (Dan Frankowski) writes:
- >In article <78304@ut-emx.uucp> jamshid@emx.utexas.edu writes:
- >>In article <1992Aug19.203838.20501@bmw.mayo.edu> staniszewski@mayo.edu writes
- >>[in lines annoyingly over 79 chars long]:
- >
- >>>The problem I am looking at is to trackdown where my dynamic memory
- >>>problems are using new and delete..
- >
- >>Why is overloading the global operator new() awkward? ..
- >> [code deleted]
-
- >Also, my question is, will this cover the global new and delete? It's
- >not an overloading. A function may be overloaded only with different
- >signatures-- that is, if the parameter lists are different. In this
- >case, you are trying to define the same function with the same
- >parameter list. I've been trying to get it to work under g++ 1.37 and
- >cfront 3.0.1, and it hangs in both cases. Should this work? Why?
-
- Sorry for the bandwidth. I answered my own question (at least on a
- cfront-based compiler), and can't get the newsreader to cancel my
- article.
-
- Answer#1: It will indeed "cover" global new and delete. If the
- reference to new is resolved in the source code, the linker will
- never look for an external definition.
-
- Answer#2: Hanging had something to do with using stream I/O in new.
- I used the default new, modified so the first line was
-
- cout << "new: Allocating " << size << " bytes.\n";
-
- If one of the ostream::operator<<()s somehow called new, that would
- explain it..
-
- >(I want to assume global new and delete cannot be replaced-- or if
- >they can, that it will not show up as __nw__FUi() under cfront 3.0.1
- >name mangling.)
-
- I can't assume any of that. The user can replace new and delete,
- and they will cover the original functions.
-
- --
- Dan Frankowski Dan.Frankowski@cray.com (612) 683-5099
-