[Feature] Improve memory pool destructors and allocation strategies
This commit introduces several improvements to the memory pool subsystem:
1. Priority-based destructors using binary heap:
- Replace linked list with min-heap for deterministic destructor ordering
- Add rspamd_mempool_add_destructor_priority() for priority control
- Maintain backward compatibility with existing rspamd_mempool_add_destructor()
- Destructors now execute in priority order (lowest first)
2. Destructor statistics and preallocation:
- Track destructor count per allocation point in entry statistics
- Preallocate heap based on historical usage patterns
- Adaptive sizing with configurable maximum (128 destructors)
3. Pool type differentiation:
- Add RSPAMD_MEMPOOL_LONG_LIVED flag for configuration/global data
- Add RSPAMD_MEMPOOL_SHORT_LIVED flag for task/temporary data
- Optimize page sizes: 16KB minimum for long-lived, 4KB for short-lived
- Provide convenience macros: rspamd_mempool_new_long_lived() and
rspamd_mempool_new_short_lived()
4. Heap utility enhancements:
- Add rspamd_min_heap_size() to query heap element count
- Enable better integration with pool statistics
Benefits:
- Controlled resource cleanup order prevents use-after-free scenarios
- Reduced memory fragmentation for long-lived pools
- Better performance for frequently created/destroyed short-lived pools
- Automatic adaptation to actual usage patterns