Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::MemoryInfo Class Reference

Memory usage information collector. More...

#include <arcane/utils/MemoryInfo.h>

Inheritance diagram for Arcane::MemoryInfo:
Collaboration diagram for Arcane::MemoryInfo:

Classes

class  MemoryInfoSorter
class  TracePrinter

Public Member Functions

virtual void createOwner (const void *owner, const TraceInfo &trace_info)
 Creates a reference on owner with the trace info trace_info.
virtual void setOwner (const void *owner, const TraceInfo &new_info)
 Modifies the info of the reference owner.
virtual void removeOwner (const void *owner)
 Removes the reference on owner.
virtual void addInfo (const void *owner, const void *ptr, Int64 size)
virtual void addInfo (const void *owner, const void *ptr, Int64 size, const void *old_ptr)
virtual void removeInfo (const void *owner, const void *ptr, bool can_fail)
virtual void changeOwner (const void *new_owner, const void *ptr)
virtual void printInfos (std::ostream &ostr)
virtual void setIteration (Integer iteration)
 Sets the current iteration number.
virtual void printAllocatedMemory (std::ostream &ostr, Integer iteration)
virtual void setTraceMng (ITraceMng *trace)
 Sets the ITraceMng for messages.
virtual void beginCollect ()
virtual void endCollect ()
virtual bool isCollecting () const
virtual void setKeepStackTrace (bool is_active)
 Indicates whether call stack saving is active.
virtual bool keepStackTrace () const
 Indicates if call stack saving is enabled.
virtual void setStackTraceMinAllocSize (Int64 alloc_size)
 Sets the minimum size of allocations whose call stack is traced.
virtual Int64 stackTraceMinAllocSize () const
 Minimum size of allocations whose call stack is traced.
virtual void visitAllocatedBlocks (IFunctorWithArgumentT< const MemoryInfoChunk & > *functor) const
 Visitor over all allocated blocks.
virtual Int64 nbAllocation () const
void checkMemory (const void *owner, Int64 size)
Public Member Functions inherited from Arcane::IMemoryInfo
virtual ~IMemoryInfo ()
 Releases resources.

Private Types

typedef std::map< const void *, MemoryInfoChunkMemoryInfoMap
typedef std::map< const void *, TraceInfoMemoryTraceInfoMap

Private Member Functions

void _removeOwner (const void *owner)
void _addMemory (const void *owner, Int64 size, const String &stack_value)
void _removeMemory (const void *owner, Int64 size)
TraceInfo_getTraceInfo (const void *owner)
void _printInfos (std::ostream &ostr)

Private Attributes

MemoryInfoMap m_infos
MemoryTraceInfoMap m_owner_infos
Int64 m_alloc_id
Int64 m_max_allocated
Int64 m_current_allocated
Int64 m_biggest_allocated
Int64 m_info_big_alloc
Int64 m_info_biggest_minimal
Int64 m_info_peak_minimal
Integer m_iteration
ITraceMngm_trace
bool m_display_max_alloc
bool m_in_display
bool m_is_first_collect
bool m_is_stack_trace_active

Detailed Description

Memory usage information collector.

Definition at line 35 of file MemoryInfo.h.

Member Typedef Documentation

◆ MemoryInfoMap

typedef std::map<const void*, MemoryInfoChunk> Arcane::MemoryInfo::MemoryInfoMap
private

Definition at line 99 of file MemoryInfo.h.

◆ MemoryTraceInfoMap

typedef std::map<const void*, TraceInfo> Arcane::MemoryInfo::MemoryTraceInfoMap
private

Definition at line 100 of file MemoryInfo.h.

Constructor & Destructor Documentation

◆ MemoryInfo()

Arcane::MemoryInfo::MemoryInfo ( )

Definition at line 186 of file MemoryInfo.cc.

◆ ~MemoryInfo()

Arcane::MemoryInfo::~MemoryInfo ( )
virtual

Definition at line 207 of file MemoryInfo.cc.

Member Function Documentation

◆ _getTraceInfo()

TraceInfo * Arcane::MemoryInfo::_getTraceInfo ( const void * owner)
private

Definition at line 635 of file MemoryInfo.cc.

◆ _printInfos()

void Arcane::MemoryInfo::_printInfos ( std::ostream & ostr)
private

Definition at line 452 of file MemoryInfo.cc.

◆ _removeMemory()

void Arcane::MemoryInfo::_removeMemory ( const void * owner,
Int64 size )
private

Definition at line 626 of file MemoryInfo.cc.

◆ _removeOwner()

void Arcane::MemoryInfo::_removeOwner ( const void * owner)
private

Definition at line 311 of file MemoryInfo.cc.

◆ addInfo() [1/2]

void Arcane::MemoryInfo::addInfo ( const void * owner,
const void * ptr,
Int64 size )
virtual

Implements Arcane::IMemoryInfo.

Definition at line 227 of file MemoryInfo.cc.

◆ addInfo() [2/2]

void Arcane::MemoryInfo::addInfo ( const void * owner,
const void * ptr,
Int64 size,
const void * old_ptr )
virtual

Implements Arcane::IMemoryInfo.

Definition at line 279 of file MemoryInfo.cc.

◆ beginCollect()

void Arcane::MemoryInfo::beginCollect ( )
virtual

Implements Arcane::IMemoryInfo.

Definition at line 535 of file MemoryInfo.cc.

◆ changeOwner()

void Arcane::MemoryInfo::changeOwner ( const void * new_owner,
const void * ptr )
virtual

Implements Arcane::IMemoryInfo.

Definition at line 288 of file MemoryInfo.cc.

◆ checkMemory()

void Arcane::MemoryInfo::checkMemory ( const void * owner,
Int64 size )

Definition at line 577 of file MemoryInfo.cc.

◆ createOwner()

void Arcane::MemoryInfo::createOwner ( const void * owner,
const TraceInfo & trace_info )
virtual

Creates a reference on owner with the trace info trace_info.

Implements Arcane::IMemoryInfo.

Definition at line 262 of file MemoryInfo.cc.

◆ endCollect()

void Arcane::MemoryInfo::endCollect ( )
virtual

Implements Arcane::IMemoryInfo.

Definition at line 559 of file MemoryInfo.cc.

◆ isCollecting()

bool Arcane::MemoryInfo::isCollecting ( ) const
virtual

Implements Arcane::IMemoryInfo.

Definition at line 568 of file MemoryInfo.cc.

◆ keepStackTrace()

virtual bool Arcane::MemoryInfo::keepStackTrace ( ) const
inlinevirtual

Indicates if call stack saving is enabled.

Implements Arcane::IMemoryInfo.

Definition at line 84 of file MemoryInfo.h.

◆ nbAllocation()

virtual Int64 Arcane::MemoryInfo::nbAllocation ( ) const
inlinevirtual

Implements Arcane::IMemoryInfo.

Definition at line 91 of file MemoryInfo.h.

◆ printAllocatedMemory()

void Arcane::MemoryInfo::printAllocatedMemory ( std::ostream & ostr,
Integer iteration )
virtual

Implements Arcane::IMemoryInfo.

Definition at line 492 of file MemoryInfo.cc.

◆ printInfos()

void Arcane::MemoryInfo::printInfos ( std::ostream & ostr)
virtual

Implements Arcane::IMemoryInfo.

Definition at line 428 of file MemoryInfo.cc.

◆ removeInfo()

void Arcane::MemoryInfo::removeInfo ( const void * owner,
const void * ptr,
bool can_fail )
virtual

Implements Arcane::IMemoryInfo.

Definition at line 333 of file MemoryInfo.cc.

◆ removeOwner()

void Arcane::MemoryInfo::removeOwner ( const void * owner)
virtual

Removes the reference on owner.

Implements Arcane::IMemoryInfo.

Definition at line 324 of file MemoryInfo.cc.

◆ setIteration()

virtual void Arcane::MemoryInfo::setIteration ( Integer iteration)
inlinevirtual

Sets the current iteration number.

Implements Arcane::IMemoryInfo.

Definition at line 68 of file MemoryInfo.h.

◆ setKeepStackTrace()

virtual void Arcane::MemoryInfo::setKeepStackTrace ( bool is_active)
inlinevirtual

Indicates whether call stack saving is active.

If is_active is true, it activates tracing the call stack of allocations. Tracing is conditional on the value of stackTraceMinAllocSize().

Implements Arcane::IMemoryInfo.

Definition at line 83 of file MemoryInfo.h.

◆ setOwner()

void Arcane::MemoryInfo::setOwner ( const void * owner,
const TraceInfo & new_info )
virtual

Modifies the info of the reference owner.

Implements Arcane::IMemoryInfo.

Definition at line 215 of file MemoryInfo.cc.

◆ setStackTraceMinAllocSize()

virtual void Arcane::MemoryInfo::setStackTraceMinAllocSize ( Int64 alloc_size)
inlinevirtual

Sets the minimum size of allocations whose call stack is traced.

For all allocations above alloc_size, the call stack is preserved in order to identify memory leaks. The memory and CPU cost of preserving a call stack is significant, and it is therefore not recommended to set a value too low (below 1000) for alloc_size. Call stack preservation is disabled if keepStackTrace() equals false.

Implements Arcane::IMemoryInfo.

Definition at line 86 of file MemoryInfo.h.

◆ setTraceMng()

void Arcane::MemoryInfo::setTraceMng ( ITraceMng * msg)
virtual

Sets the ITraceMng for messages.

Implements Arcane::IMemoryInfo.

Definition at line 526 of file MemoryInfo.cc.

◆ stackTraceMinAllocSize()

virtual Int64 Arcane::MemoryInfo::stackTraceMinAllocSize ( ) const
inlinevirtual

Minimum size of allocations whose call stack is traced.

Implements Arcane::IMemoryInfo.

Definition at line 87 of file MemoryInfo.h.

◆ visitAllocatedBlocks()

void Arcane::MemoryInfo::visitAllocatedBlocks ( IFunctorWithArgumentT< const MemoryInfoChunk & > * functor) const
virtual

Visitor over all allocated blocks.

Implements Arcane::IMemoryInfo.

Definition at line 647 of file MemoryInfo.cc.

Member Data Documentation

◆ m_alloc_id

Int64 Arcane::MemoryInfo::m_alloc_id
private

Definition at line 105 of file MemoryInfo.h.

◆ m_biggest_allocated

Int64 Arcane::MemoryInfo::m_biggest_allocated
private

Definition at line 108 of file MemoryInfo.h.

◆ m_current_allocated

Int64 Arcane::MemoryInfo::m_current_allocated
private

Definition at line 107 of file MemoryInfo.h.

◆ m_display_max_alloc

bool Arcane::MemoryInfo::m_display_max_alloc
private

Definition at line 114 of file MemoryInfo.h.

◆ m_in_display

bool Arcane::MemoryInfo::m_in_display
private

Definition at line 115 of file MemoryInfo.h.

◆ m_info_big_alloc

Int64 Arcane::MemoryInfo::m_info_big_alloc
private

Definition at line 109 of file MemoryInfo.h.

◆ m_info_biggest_minimal

Int64 Arcane::MemoryInfo::m_info_biggest_minimal
private

Definition at line 110 of file MemoryInfo.h.

◆ m_info_peak_minimal

Int64 Arcane::MemoryInfo::m_info_peak_minimal
private

Definition at line 111 of file MemoryInfo.h.

◆ m_infos

MemoryInfoMap Arcane::MemoryInfo::m_infos
private

Definition at line 102 of file MemoryInfo.h.

◆ m_is_first_collect

bool Arcane::MemoryInfo::m_is_first_collect
private

Definition at line 116 of file MemoryInfo.h.

◆ m_is_stack_trace_active

bool Arcane::MemoryInfo::m_is_stack_trace_active
private

Definition at line 117 of file MemoryInfo.h.

◆ m_iteration

Integer Arcane::MemoryInfo::m_iteration
private

Definition at line 112 of file MemoryInfo.h.

◆ m_max_allocated

Int64 Arcane::MemoryInfo::m_max_allocated
private

Definition at line 106 of file MemoryInfo.h.

◆ m_owner_infos

MemoryTraceInfoMap Arcane::MemoryInfo::m_owner_infos
private

Definition at line 103 of file MemoryInfo.h.

◆ m_trace

ITraceMng* Arcane::MemoryInfo::m_trace
private

Definition at line 113 of file MemoryInfo.h.


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