Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion::base::FullAllocationTracker Class Reference

FullAllocationTracker is a derived AllocationTracker class that keeps track of all active allocations and also provides tracing facilities for debugging and error checking of leaked allocations. More...

#include "fullallocationtracker.h"

Inheritance diagram for ion::base::FullAllocationTracker:
Collaboration diagram for ion::base::FullAllocationTracker:

Public Member Functions

 FullAllocationTracker ()
 FullAllocationTracker functions. More...
 
void SetTracingStream (std::ostream *s)
 Sets an output stream to use for tracing allocations and deallocations. More...
 
std::ostream * GetTracingStream () const
 
void TrackAllocation (const Allocator &allocator, size_t requested_size, const void *memory) override
 AllocationTracker interface implementations. More...
 
void TrackDeallocation (const Allocator &allocator, const void *memory) override
 TrackDeallocation() is called immediately before an Allocator deallocates memory. More...
 
size_t GetAllocationCount () override
 Returns the total number of tracked allocations or deallocations. More...
 
size_t GetDeallocationCount () override
 
size_t GetAllocatedBytesCount () override
 Returns the total number of memory ever allocated or deallocated, in bytes. More...
 
size_t GetDeallocatedBytesCount () override
 
size_t GetActiveAllocationCount () override
 Returns the number of active allocations or the amount of memory in bytes used by active allocations. More...
 
size_t GetActiveAllocationBytesCount () override
 
void SetGpuTracker (const AllocationSizeTrackerPtr &gpu_tracker) override
 Sets/returns an AllocationSizeTracker instance used to track GPU memory allocations. More...
 
AllocationSizeTrackerPtr GetGpuTracker () override
 
int GetRefCount () const
 GetRefCount() is part of the interface necessary for SharedPtr. More...
 

Protected Member Functions

 ~FullAllocationTracker () override
 The destructor is protected because all instances should be managed through SharedPtr. More...
 

Detailed Description

FullAllocationTracker is a derived AllocationTracker class that keeps track of all active allocations and also provides tracing facilities for debugging and error checking of leaked allocations.

Definition at line 32 of file fullallocationtracker.h.

Constructor & Destructor Documentation

ion::base::FullAllocationTracker::FullAllocationTracker ( )

FullAllocationTracker functions.

Definition at line 207 of file fullallocationtracker.cc.

ion::base::FullAllocationTracker::~FullAllocationTracker ( )
overrideprotected

The destructor is protected because all instances should be managed through SharedPtr.

This logs an error for each allocation that is still active.

Definition at line 211 of file fullallocationtracker.cc.

Member Function Documentation

size_t ion::base::FullAllocationTracker::GetActiveAllocationBytesCount ( )
overridevirtual

Implements ion::base::AllocationTracker.

Definition at line 262 of file fullallocationtracker.cc.

size_t ion::base::FullAllocationTracker::GetActiveAllocationCount ( )
overridevirtual

Returns the number of active allocations or the amount of memory in bytes used by active allocations.

These are not guaranteed to be supported by all derived classes; they may return 0 if not.

Implements ion::base::AllocationTracker.

Definition at line 258 of file fullallocationtracker.cc.

size_t ion::base::FullAllocationTracker::GetAllocatedBytesCount ( )
overridevirtual

Returns the total number of memory ever allocated or deallocated, in bytes.

These are not guaranteed to be supported by all derived classes; they may return 0 if not.

Implements ion::base::AllocationTracker.

Definition at line 250 of file fullallocationtracker.cc.

size_t ion::base::FullAllocationTracker::GetAllocationCount ( )
overridevirtual

Returns the total number of tracked allocations or deallocations.

Implements ion::base::AllocationTracker.

Definition at line 242 of file fullallocationtracker.cc.

size_t ion::base::FullAllocationTracker::GetDeallocatedBytesCount ( )
overridevirtual

Implements ion::base::AllocationTracker.

Definition at line 254 of file fullallocationtracker.cc.

size_t ion::base::FullAllocationTracker::GetDeallocationCount ( )
overridevirtual

Implements ion::base::AllocationTracker.

Definition at line 246 of file fullallocationtracker.cc.

AllocationSizeTrackerPtr ion::base::FullAllocationTracker::GetGpuTracker ( )
overridevirtual

Implements ion::base::AllocationTracker.

Definition at line 268 of file fullallocationtracker.cc.

int ion::base::Shareable::GetRefCount ( ) const
inlineinherited

GetRefCount() is part of the interface necessary for SharedPtr.

Definition at line 34 of file shareable.h.

Referenced by ion::base::Notifier::RemoveReceiver().

std::ostream* ion::base::FullAllocationTracker::GetTracingStream ( ) const
inline

Definition at line 41 of file fullallocationtracker.h.

void ion::base::FullAllocationTracker::SetGpuTracker ( const AllocationSizeTrackerPtr gpu_tracker)
overridevirtual

Sets/returns an AllocationSizeTracker instance used to track GPU memory allocations.

Implements ion::base::AllocationTracker.

Definition at line 266 of file fullallocationtracker.cc.

void ion::base::FullAllocationTracker::SetTracingStream ( std::ostream *  s)
inline

Sets an output stream to use for tracing allocations and deallocations.

If the stream is non-NULL, tracing is enabled, and a message is printed to the stream for each allocation or deallocation. The default is a NULL stream.

Definition at line 40 of file fullallocationtracker.h.

void ion::base::FullAllocationTracker::TrackAllocation ( const Allocator allocator,
size_t  requested_size,
const void *  memory 
)
overridevirtual

AllocationTracker interface implementations.

Implements ion::base::AllocationTracker.

Definition at line 216 of file fullallocationtracker.cc.

void ion::base::FullAllocationTracker::TrackDeallocation ( const Allocator allocator,
const void *  memory 
)
overridevirtual

TrackDeallocation() is called immediately before an Allocator deallocates memory.

It receives a reference to the Allocator that is deallocating the memory and a pointer to the deallocated memory.

Implements ion::base::AllocationTracker.

Definition at line 226 of file fullallocationtracker.cc.

References ion::port::ERROR, ion::base::kInvalidIndex, and LOG.


The documentation for this class was generated from the following files: