Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
CObject::operator new
CObject                                     Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  void* operator new( size_t nSize )
  throw( CMemoryException );
  void* operator new( size_t nSize, const char FAR* lpszFileName,
                      int nLine )
  throw( CMemoryException );
 
  Remarks
 
  For the Release version of the library, operator new performs an optimal
  memory allocation in a manner similar to malloc. In the Debug version,
  operator new participates in an allocation-monitoring scheme designed to
  detect memory leaks.
 
  If you use the code line:
 
      #define new DEBUG_NEW
 
  before any of your implementations in a .CPP file, then the second
  version of new will be used, storing the filename and line number in the
  allocated block for later reporting. You do not have to worry about
  supplying the extra parameters; a macro takes care of that for you.
 
  Even if you don't use DEBUG_NEW in Debug mode, you still get leak
  detection, but without the source file line number reporting described
  above.
 
  NOTE: If you override this operator, you must also override delete. Do
        not use the standard library _new_handler function.
 
  See Also
 
  CObject::operator delete
 
 
                                     -♦-