@@ -293,8 +293,7 @@ class MemHeader
293293
294294public:
295295#ifdef DEBUG_GDS_ALLOC
296- INT32 lineNumber = -1 ;
297- const char *fileName = nullptr ;
296+ Firebird::CustomSourceLocation location;
298297#elif (SIZEOF_VOID_P == 4)
299298 FB_UINT64 dummyAlign;
300299#endif
@@ -412,16 +411,16 @@ class MemHeader
412411 {
413412 bool filter = filter_path != NULL ;
414413
415- if (isActive () && filter && fileName)
416- filter = strncmp (filter_path, fileName, filter_len) != 0 ;
414+ if (isActive () && filter && location. fileName )
415+ filter = strncmp (filter_path, location. fileName , filter_len) != 0 ;
417416
418417 if (!filter)
419418 {
420419 if (isActive () || redirected ())
421420 {
422421 fprintf (file, " %s %p: size=%" SIZEFORMAT " allocated at %s:%d" ,
423422 isExtent () ? " EXTN" : redirected () ? " RDIR" : " USED" ,
424- this , getSize (), fileName, lineNumber );
423+ this , getSize (), location. fileName , location. line );
425424 }
426425 else
427426 fprintf (file, " FREE %p: size=%" SIZEFORMAT , this , getSize ());
@@ -2126,16 +2125,15 @@ void MemPool::newExtent(size_t& size, Extent** linkedList)
21262125 size = extent->spaceRemaining ;
21272126}
21282127
2129- MemoryPool* MemoryPool::createPool (ALLOC_PARAMS1 MemoryPool* parentPool, MemoryStats& stats)
2128+ MemoryPool* MemoryPool::createPool (MemoryPool* parentPool, MemoryStats& stats ALLOC_PARAMS_DEF )
21302129{
21312130 if (!parentPool)
21322131 parentPool = getDefaultMemoryPool ();
21332132
21342133 MemPool* p = new (*parentPool ALLOC_PASS_ARGS ) MemPool (*(parentPool->pool ), stats, &defaultExtentsCache);
21352134#ifdef MEM_DEBUG
21362135#ifdef DEBUG_LOST_POOLS
2137- p->fileName = file;
2138- p->lineNum = line;
2136+ p->location = location;
21392137
21402138 static std::atomic<int > seqGen = 0 ;
21412139 p->seq = ++seqGen;
@@ -2231,7 +2229,7 @@ MemBlock* MemPool::allocateInternal2(size_t from, size_t& length, bool flagRedir
22312229 return hunk->block ;
22322230}
22332231
2234- MemBlock* MemPool::allocateRange (size_t from, size_t & size ALLOC_PARAMS )
2232+ MemBlock* MemPool::allocateRange (size_t from, size_t & size ALLOC_PARAMS_DEF )
22352233{
22362234 size_t length = from ? size : ROUNDUP (size + VALGRIND_REDZONE , roundingSize) + GUARD_BYTES ;
22372235 MemBlock* memory = allocateInternal (from, length, true );
@@ -2242,8 +2240,7 @@ MemBlock* MemPool::allocateRange(size_t from, size_t& size ALLOC_PARAMS)
22422240#endif
22432241
22442242#ifdef DEBUG_GDS_ALLOC
2245- memory->fileName = file;
2246- memory->lineNumber = line;
2243+ memory->location = location;
22472244#endif
22482245
22492246#ifdef MEM_DEBUG
@@ -2260,7 +2257,7 @@ MemBlock* MemPool::allocateRange(size_t from, size_t& size ALLOC_PARAMS)
22602257}
22612258
22622259
2263- void * MemPool::allocate (size_t size ALLOC_PARAMS )
2260+ void * MemPool::allocate (size_t size ALLOC_PARAMS_DEF )
22642261{
22652262#ifdef VALIDATE_POOL
22662263 MutexLockGuard guard (mutex, " MemPool::allocate" );
@@ -2335,7 +2332,7 @@ void MemPool::releaseMemory(void* object, bool flagExtent) noexcept
23352332 block->valgrindInternal ();
23362333
23372334#ifdef DEBUG_GDS_ALLOC
2338- block->fileName = NULL ;
2335+ block->location . fileName = nullptr ;
23392336#endif
23402337
23412338 // Finally delete it
@@ -2506,7 +2503,7 @@ void* MemPool::getExtent(size_t from, size_t& to) // pass desired minimum size,
25062503#ifdef VALIDATE_POOL
25072504 MutexLockGuard guard (mutex, " MemPool::getExtent" );
25082505#endif
2509- MemBlock* extent = allocateRange (from, to ALLOC_ARGS );
2506+ MemBlock* extent = allocateRange (from, to);
25102507 extent->setExtent ();
25112508 return &extent->body ;
25122509}
@@ -2622,7 +2619,7 @@ void MemPool::globalFree(void* block) noexcept
26222619 deallocate (block);
26232620}
26242621
2625- void * MemoryPool::calloc (size_t size ALLOC_PARAMS )
2622+ void * MemoryPool::calloc (size_t size ALLOC_PARAMS_DEF )
26262623{
26272624 void * block = allocate (size ALLOC_PASS_ARGS );
26282625 memset (block, 0 , size);
@@ -2768,7 +2765,7 @@ MemoryPool& AutoStorage::getAutoMemoryPool()
27682765 return *p;
27692766}
27702767
2771- void * MemoryPool::allocate (size_t size ALLOC_PARAMS )
2768+ void * MemoryPool::allocate (size_t size ALLOC_PARAMS_DEF )
27722769{
27732770 return pool->allocate (size ALLOC_PASS_ARGS );
27742771}
@@ -3037,12 +3034,12 @@ void AutoStorage::ProbeStack() const noexcept
30373034
30383035void * operator new (size_t s)
30393036{
3040- return getExternalMemoryPool ()->allocate (s ALLOC_ARGS );
3037+ return getExternalMemoryPool ()->allocate (s);
30413038}
30423039
30433040void * operator new [](size_t s)
30443041{
3045- return getExternalMemoryPool ()->allocate (s ALLOC_ARGS );
3042+ return getExternalMemoryPool ()->allocate (s);
30463043}
30473044
30483045void operator delete (void * mem) noexcept
0 commit comments