--- parser3/src/include/pa_memory.h 2005/08/05 14:13:41 1.11.14.2 +++ parser3/src/include/pa_memory.h 2009/04/18 00:33:34 1.17 @@ -1,7 +1,7 @@ /** @file Parser: memory reference counting classes decls. - Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2009 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ @@ -9,20 +9,18 @@ #ifndef PA_MEMORY_H #define PA_MEMORY_H -static const char * const IDENT_MEMORY_H="$Date: 2005/08/05 14:13:41 $"; +static const char * const IDENT_MEMORY_H="$Date: 2009/04/18 00:33:34 $"; // include #include "pa_config_includes.h" - -/// to debug backtrace pointers switch this on: -#ifdef _DEBUG -#define GC_DEBUG -#endif #include "gc.h" // defines +// use destructors for Array, Hash and VMethodFrame +#define USE_DESTRUCTORS + //#define PA_DEBUG_GC_MEMORY #ifdef PA_DEBUG_GC_MEMORY @@ -82,15 +80,13 @@ inline void *pa_realloc(void *ptr, size_ return pa_fail_alloc("reallocate to", size); } -//{@ these operators are disabled, one should explicitely specify either new(UseGC) or new(PointerFreeGC) -#if _MSC_VER -# pragma warning(disable:4702) // disable warning -#endif -inline void *operator new(size_t) { abort(); } // disabled -inline void *operator new[] (size_t) { abort(); } // disabled -#if _MSC_VER -# pragma warning(default:4702) -#endif +//{@ these operators can be used from stl. to be on a safe side, assume that data may contain pointers +inline void *operator new[] (size_t size) { + return pa_malloc(size); +} +inline void *operator new(size_t size) { + return pa_malloc(size); +} //}@ #define UseGC ((int)1)