corealloc adjustments:

- re-enabled default memory initialization in DEBUG builds (should make random crashes less random)
- moved defines from header to source since they are only used locally and not globally
- added file/line information to global_free* and fixed src/emu/sound/spu.c compilation
This commit is contained in:
Oliver Stöneberg 2014-05-15 12:09:20 +00:00
parent 175dedacfc
commit 36ad612f60
3 changed files with 11 additions and 15 deletions

View File

@ -319,7 +319,7 @@ public:
if (ref_count==0)
{
cache_size-=(dend-data)<<1;
global_free(this);
global_free(const_cast<sample_cache*>(this));
}
}

View File

@ -18,6 +18,14 @@
#define LOG_ALLOCS (0)
// define this to initialize allocated memory to a fixed non-0 value
#ifdef MAME_DEBUG
#define INITIALIZE_ALLOCATED_MEMORY
#endif
// define this to zap memory to a fixed non-0 value before freeing
//#define OVERWRITE_FREED_MEMORY
//**************************************************************************

View File

@ -18,18 +18,6 @@
#include "osdcore.h"
//**************************************************************************
// DEBUGGING
//**************************************************************************
// define this to initialize allocated memory to a fixed non-0 value
//#define INITIALIZE_ALLOCATED_MEMORY
// define this to zap memory to a fixed non-0 value before freeing
//#define OVERWRITE_FREED_MEMORY
//**************************************************************************
// MACROS
//**************************************************************************
@ -39,8 +27,8 @@
#define global_alloc_clear(_type) new(__FILE__, __LINE__, zeromem) _type
#define global_alloc_array(_type, _num) new(__FILE__, __LINE__) _type[_num]
#define global_alloc_array_clear(_type, _num) new(__FILE__, __LINE__, zeromem) _type[_num]
#define global_free(_ptr) do { delete _ptr; } while (0)
#define global_free_array(_ptr) do { delete[] _ptr; } while (0)
#define global_free(_ptr) do { operator delete(_ptr, __FILE__, __LINE__); } while (0)
#define global_free_array(_ptr) do { operator delete[](_ptr, __FILE__, __LINE__); } while (0)