home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!gatech!udel!rochester!rocksanne!news
- From: Heliotis.ROCH803@xerox.com (Jim Heliotis)
- Subject: Overloading new without redefining new&delete?
- Message-ID: <1992Dec23.154447.17420@spectrum.xerox.com>
- Keywords: storage debug
- Sender: news@spectrum.xerox.com
- Reply-To: Heliotis.ROCH803@xerox.com
- Organization: Xerox Corporation, East Rochester, NY
- Date: Wed, 23 Dec 1992 15:44:47 GMT
- Lines: 31
-
- We wrote a version of new that takes extra arguments (namely, file name
- and line #) so that debug information can be kept with every block of
- storage allocated that uses this version of new. We are doing this to
- monitor storage leaks.
-
- That's the specific situation; now, the general problem:
-
- Writing a custom new does not allow one to write a corresponding
- delete, since delete cannot be overloaded (we're talking global
- new/delete here, not class-specific). This means that, if any special
- handling is required at delete time for this custom-allocated storage,
- you must rewrite the standard delete. This in turn means that no code
- has access anymore to the old delete, so storage allocated with the
- standard new could not be freed. This means that you must customize
- the standard new so that delete is sure of from whence the storage
- came.
-
- Whew! Did anyone understand that? If so, let me know if you have an
- easier solution (besides "use garbage collection"). Thanks.
-
- ============================================================================
- Jim Heliotis Voice Phone: 716-383-7410
- Xerox Corporation FAX Phone: 716-383-7395
- 435 W. Commercial St. Mail Stop: 803-01A
- East Rochester, NY 14445 Electronic Mail: JEH.ROCH803@Xerox.COM
- ============================================================================
-
-
-
-
-
-