From 78c44b42bf4a07b0caf7d27b1dfb4725f14531f6 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Wed, 6 Aug 2003 02:32:50 +0000 Subject: "" svn path=/trunk/; revision=828 --- externals/grill/flext/source/flsupport.cpp | 7 +++++++ externals/grill/flext/source/flsupport.h | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'externals/grill/flext/source') diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp index b27196b8..eca73d90 100644 --- a/externals/grill/flext/source/flsupport.cpp +++ b/externals/grill/flext/source/flsupport.cpp @@ -82,11 +82,18 @@ void flext::Setup() void *flext::operator new(size_t bytes) { bytes += sizeof(size_t); + +#ifdef FLEXT_DEBUG + if(bytes > 32000) + post("flext - warning: excessive memory allocation of %i bytes",bytes); +#endif + #if FLEXT_SYS == FLEXT_SYS_JMAX char *blk = (char *)::fts_malloc(bytes); #else char *blk = (char *)::getbytes(bytes); #endif + *(size_t *)blk = bytes; return blk+sizeof(size_t); } diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h index f0b3d34f..ac875980 100644 --- a/externals/grill/flext/source/flsupport.h +++ b/externals/grill/flext/source/flsupport.h @@ -69,7 +69,8 @@ public: */ /*! Overloaded new memory allocation method - \warning Max/MSP (or MacOS) allows only 16K in overdrive mode! + \note this uses a fast allocation method of the real-time system + \warning Max/MSP (or MacOS) allows only 32K in overdrive mode! */ void *operator new(size_t bytes); //! Overloaded delete method @@ -80,6 +81,13 @@ public: void operator delete[](void *blk) { operator delete(blk); } #endif + /*! Get a large memory block + the normal C library function is used here + */ + static void *NewLarge(size_t bytes) { return ::operator new(bytes); } + //! Free a large memory block + static void FreeLarge(void *blk) { return ::operator delete(blk); } + //! Get an aligned memory block static void *NewAligned(size_t bytes,int bitalign = 128); //! Free an aligned memory block -- cgit v1.2.1