I know of many very smart people who have tried to lick this problem without success. Iy feels like there should be a solution, but avoiding an ABA problem on release seems insurmountable.
An alternate solution that is close is thread specific sub-pools, which is nice because a thread specific sub-pool doesn't even need interlocked instructions. It does require a fetch of thread specific data on every allocate and release, but some platforms dedicate a register to point to thread specific data, making the op essentially free. Thread specific sub-pools does make fragmentation slightly worse. And, of course, each thread specific sub-pool needs to be flushed back to the main pool. I'm not suggesting that this is a priority or even a good fit for Firebird, but just that the assumption of a no-lock memory pool is probably unsound.
------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel