2 * Copyright (c) 1994 by Xerox Corporation. All rights reserved.
4 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
5 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
7 * Last modified on Sat Nov 19 19:31:14 PST 1994 by ellis
9 * Permission is hereby granted to copy this code for any purpose,
10 * provided the above notices are retained on all copies.
13 /*************************************************************************
14 This implementation module for gc_c++.h provides an implementation of
15 the global operators "new" and "delete" that calls the Boehm
16 allocator. All objects allocated by this implementation will be
17 non-collectable but part of the root set of the collector.
19 You should ensure (using implementation-dependent techniques) that the
20 linker finds this module before the library that defines the default
21 built-in "new" and "delete".
23 Authors: John R. Ellis and Jesse Hull
25 **************************************************************************/
28 # include "private/config.h"
37 void* operator new( size_t size ) {
38 return GC_MALLOC_UNCOLLECTABLE( size );}
40 #if !defined(__CYGWIN__)
41 void operator delete( void* obj ) {
44 #endif /* !__CYGWIN__ */
46 #ifdef GC_OPERATOR_NEW_ARRAY
48 void* operator new[]( size_t size ) {
49 return GC_MALLOC_UNCOLLECTABLE( size );}
51 void operator delete[]( void* obj ) {
54 #endif /* GC_OPERATOR_NEW_ARRAY */
58 // This new operator is used by VC++ in case of Debug builds !
59 void* operator new( size_t size,
61 const char * szFileName,
65 return GC_malloc_uncollectable( size );
67 return GC_debug_malloc_uncollectable(size, szFileName, nLine);
72 // This new operator is used by VC++ 7.0 and later in Debug builds.
73 void* operator new[](size_t size, int nBlockUse, const char* szFileName, int nLine)
75 return operator new(size, nBlockUse, szFileName, nLine);