People, in fb_blk.h we have:

        void operator delete(void* mem, MemoryPool& p)
        {
                if (mem)
                        p.deallocate(mem);
        }

        void operator delete[](void* mem, MemoryPool& p)
        {
                if (mem)
                        p.deallocate(mem);
        }

but the compiler always says that "p" is ignored. Well, I changed it to

        void operator delete(void* mem, MemoryPool& /*p*/)
        {
                if (mem)
                        MemoryPool::deallocate(mem); // deallocate is static
        }

        void operator delete[](void* mem, MemoryPool& /*p*/)
        {
                if (mem)
                        MemoryPool::deallocate(mem); // deallocate is static
        }

then Dmitry suggests trying to see if they are needed really. We have the
next pair

        void operator delete(void* mem)
        {
                if (mem)
                        MemoryPool::globalFree(mem);
        }

        void operator delete[](void* mem)
        {
                if (mem)
                        MemoryPool::globalFree(mem);
        }

and if I get rid of the MemoryPool parameter, both set of calls are the
same, because globalFree calls deallocate in alloc.cpp:

void MemoryPool::globalFree(void* block) throw ()
{
        deallocate(block);
}

Can someone suggest how and when is the compiler using the delete operators
with MemoryPool as second argument? It seems a leftover. Certainly, FB_NEW
and FB_NEW_RPT play with pools, but I see nothing else.

Thanks.

C.
---
Claudio Valderrama C. - www.cvalde.net
Consultant, SW developer.


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to