|
Blender V5.0
|
#include <BLI_memory_counter.hh>
Inherits blender::NonCopyable, and blender::NonMovable.
Public Member Functions | |
| MemoryCounter (MemoryCount &count) | |
| void | add (const int64_t bytes) |
| void | add_shared (const ImplicitSharingInfo *sharing_info, const FunctionRef< void(MemoryCounter &shared_memory)> count_fn) |
| void | add_shared (const ImplicitSharingInfo *sharing_info, const int64_t bytes) |
MemoryCounter helps counting the amount of memory used in cases where data is shared and should not be double-counted. To achieve that, it counts bytes that are uniquely owned separately from those that are shared.
Definition at line 39 of file BLI_memory_counter.hh.
Definition at line 13 of file memory_counter.cc.
| void blender::memory_counter::MemoryCounter::add | ( | const int64_t | bytes | ) |
Add bytes that are uniquely owned, i.e. not shared.
Definition at line 15 of file memory_counter.cc.
| void blender::memory_counter::MemoryCounter::add_shared | ( | const ImplicitSharingInfo * | sharing_info, |
| const FunctionRef< void(MemoryCounter &shared_memory)> | count_fn ) |
Add (potentially) shared data which should not be counted twice.
| sharing_info | The sharing info that owns the data. If null, the data is assumed to be uniquely owned. |
| count_fn | Function to count the amount of memory used by the shared data. This is only called if the shared memory was not counted before. It's a callback, because sometimes counting the amount of used memory can be a bit more involved. |
| void blender::memory_counter::MemoryCounter::add_shared | ( | const ImplicitSharingInfo * | sharing_info, |
| const int64_t | bytes ) |
Same as above, but takes in the number of bytes directly instead of callback. This is easier to use in cases where computing the number of bytes is very cheap.
Definition at line 38 of file memory_counter.cc.