| 2189 | |
| 2190 | |
| 2191 | void SortOwner::unlinkAll() |
| 2192 | { |
| 2193 | while (sorts.getCount()) |
| 2194 | delete sorts.pop(); |
| 2195 | |
| 2196 | if (buffers.hasData()) |
| 2197 | { |
| 2198 | // Move cached buffers to the database level cache to be reused later by other attachments |
| 2199 | |
| 2200 | const size_t MAX_CACHED_SORT_BUFFERS = 8; // 1MB |
| 2201 | |
| 2202 | SyncLockGuard guard(&dbb->dbb_sortbuf_sync, SYNC_EXCLUSIVE, FB_FUNCTION); |
| 2203 | |
| 2204 | while (buffers.hasData() && dbb->dbb_sort_buffers.getCount() < MAX_CACHED_SORT_BUFFERS) |
| 2205 | dbb->dbb_sort_buffers.push(buffers.pop()); |
| 2206 | } |
| 2207 | |
| 2208 | while (buffers.hasData()) |
| 2209 | delete[] buffers.pop(); |
| 2210 | } |
| 2211 | |
| 2212 | |
| 2213 | /// class PartitionedSort |
no test coverage detected