diagnosticCalloc top-level constant
DiagnosticCallocAllocator
const diagnosticCalloc
A zero-initializing allocator that always retains leak-tracking capability.
Unlike adaptiveCalloc, this allocator is never optimized away in release builds. It records allocation metadata with the leak tracker in every build mode whenever leak tracking is enabled.
Platform behavior:
- Windows: uses
CoTaskMemAlloc/CoTaskMemFree - POSIX: uses
calloc/free
This allocator is intended for explicit diagnostic scenarios — for example, when investigating memory issues that only reproduce in release builds. Avoid using it as a general-purpose allocator in performance-sensitive code.
Implementation
const diagnosticCalloc = DiagnosticCallocAllocator._();