allocationTracker
-
namespace integrator_allocation_test
Enums
-
enum class AllocationApi : std::size_t
Allocation and deallocation APIs distinguished by the test counters.
Values:
-
enumerator CppNew
-
enumerator CppDelete
-
enumerator CppAlignedNew
-
enumerator CppAlignedDelete
-
enumerator Malloc
-
enumerator Calloc
-
enumerator Realloc
-
enumerator Free
-
enumerator AlignedAlloc
-
enumerator PosixMemalign
-
enumerator Memalign
-
enumerator Count
-
enumerator CppNew
Functions
-
template<typename Callable>
AllocationSnapshot trackAllocations(Callable &&callable) Reset the counters and track allocation calls made while invoking a callable.
- Template Parameters:
Callable – Type of the callable to invoke without arguments.
- Parameters:
callable – Operation to observe on the current thread.
- Returns:
Snapshot of allocation and deallocation counts after the callable returns.
-
struct AllocationSnapshot
- #include <allocationTracker.h>
Copy of the intercepted allocation and deallocation API call counts.
Public Functions
-
inline std::uint64_t operator[](AllocationApi api) const noexcept
Read the count for one intercepted API.
- Parameters:
api – Allocation or deallocation API to inspect; AllocationApi::Count is not a valid index.
- Returns:
Number of recorded calls to the selected API.
-
std::uint64_t allocationCalls() const noexcept
Sum allocation API calls, including realloc calls.
- Returns:
Total count of allocation API calls in this snapshot.
-
std::uint64_t deallocationCalls() const noexcept
Sum delete and free API calls.
- Returns:
Total count of deallocation API calls in this snapshot.
-
std::uint64_t totalCalls() const noexcept
Sum allocation and deallocation API calls.
- Returns:
Total count of all intercepted API calls in this snapshot.
Public Members
-
std::array<std::uint64_t, static_cast<std::size_t>(AllocationApi::Count)> calls = {}
Call counts by API.
-
inline std::uint64_t operator[](AllocationApi api) const noexcept
-
class ScopedAllocationTracking
- #include <allocationTracker.h>
Nestable scope that enables allocation tracking on the current thread.
Public Functions
-
ScopedAllocationTracking() noexcept
Enter an allocation-tracking scope without clearing existing counts.
-
~ScopedAllocationTracking()
Leave this scope, preserving any enclosing tracking scope.
-
ScopedAllocationTracking(const ScopedAllocationTracking&) = delete
-
ScopedAllocationTracking &operator=(const ScopedAllocationTracking&) = delete
-
ScopedAllocationTracking() noexcept
-
class ScopedAllocationSuspension
- #include <allocationTracker.h>
Nestable scope that suspends allocation tracking on the current thread.
Public Functions
-
ScopedAllocationSuspension() noexcept
Suspend tracking without changing the recorded counts.
-
~ScopedAllocationSuspension()
Restore the enclosing tracking and suspension state.
-
ScopedAllocationSuspension(const ScopedAllocationSuspension&) = delete
-
ScopedAllocationSuspension &operator=(const ScopedAllocationSuspension&) = delete
-
ScopedAllocationSuspension() noexcept
-
namespace detail
-
enum class AllocationApi : std::size_t