The destroy() function MUST be used to delete a Database object. The function hides some tricky order of operations. Since the memory for the vectors in the Database is allocated out of the Database's permanent memory pool, the entire delete() operation needs to complete _before_ the permanent pool is deleted, or else risk an aborted engine.
| 412 | // to complete _before_ the permanent pool is deleted, or else |
| 413 | // risk an aborted engine. |
| 414 | static void destroy(Database* const toDelete) |
| 415 | { |
| 416 | if (!toDelete) |
| 417 | return; |
| 418 | |
| 419 | MemoryPool* const perm = toDelete->dbb_permanent; |
| 420 | |
| 421 | // Memory pool destruction below decrements memory statistics |
| 422 | // situated in database block we are about to deallocate right now |
| 423 | Firebird::MemoryStats temp_stats; |
| 424 | perm->setStatsGroup(temp_stats); |
| 425 | |
| 426 | delete toDelete; |
| 427 | MemoryPool::deletePool(perm); |
| 428 | } |
| 429 | |
| 430 | static ULONG getLockOwnerId() |
| 431 | { |
nothing calls this directly
no test coverage detected