12#ifndef ARCANE_UTILS_MEMORYINFO_H
13#define ARCANE_UTILS_MEMORYINFO_H
17#include "arcane/utils/IMemoryInfo.h"
18#include "arcane/utils/TraceInfo.h"
35class ARCANE_UTILS_EXPORT MemoryInfo
46 virtual ~MemoryInfo();
58 virtual void addInfo(
const void* owner,
const void* ptr,
Int64 size);
60 virtual void addInfo(
const void* owner,
const void* ptr,
Int64 size,
const void* old_ptr);
62 virtual void removeInfo(
const void* owner,
const void* ptr,
bool can_fail);
64 virtual void changeOwner(
const void* new_owner,
const void* ptr);
66 virtual void printInfos(std::ostream& ostr);
70 m_iteration = iteration;
72 virtual void printAllocatedMemory(std::ostream& ostr,
Integer iteration);
73 virtual void setTraceMng(
ITraceMng* trace);
77 virtual void beginCollect();
78 virtual void endCollect();
79 virtual bool isCollecting()
const;
91 virtual Int64 nbAllocation()
const {
return m_alloc_id; }
95 void checkMemory(
const void* owner, Int64 size);
99 typedef std::map<const void*, MemoryInfoChunk> MemoryInfoMap;
100 typedef std::map<const void*, TraceInfo> MemoryTraceInfoMap;
102 MemoryInfoMap m_infos;
103 MemoryTraceInfoMap m_owner_infos;
106 Int64 m_max_allocated;
107 Int64 m_current_allocated;
108 Int64 m_biggest_allocated;
109 Int64 m_info_big_alloc;
110 Int64 m_info_biggest_minimal;
111 Int64 m_info_peak_minimal;
114 bool m_display_max_alloc;
116 bool m_is_first_collect;
117 bool m_is_stack_trace_active;
121 void _removeOwner(
const void* owner);
122 void _addMemory(
const void* owner, Int64 size,
const String& stack_value);
123 void _removeMemory(
const void* owner, Int64 size);
124 TraceInfo* _getTraceInfo(
const void* owner);
125 void _printInfos(std::ostream& ostr);
132arcaneGlobalTrueMemoryInfo();
133extern "C++" ARCANE_UTILS_EXPORT
void
134arcaneInitCheckMemory();
135extern "C++" ARCANE_UTILS_EXPORT
void
136arcaneExitCheckMemory();
Interface of a functor with an argument but without a return value.
Memory usage information collector.
virtual Int64 stackTraceMinAllocSize() const
Minimum size of allocations whose call stack is traced.
virtual bool keepStackTrace() const
Indicates if call stack saving is enabled.
virtual void createOwner(const void *owner, const TraceInfo &trace_info)
Creates a reference on owner with the trace info trace_info.
virtual void setStackTraceMinAllocSize(Int64 alloc_size)
Sets the minimum size of allocations whose call stack is traced.
virtual void setOwner(const void *owner, const TraceInfo &new_info)
Modifies the info of the reference owner.
virtual void setIteration(Integer iteration)
Sets the current iteration number.
virtual void removeOwner(const void *owner)
Removes the reference on owner.
virtual void setKeepStackTrace(bool is_active)
Indicates whether call stack saving is active.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.