MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / setMaxMemorySize

Method setMaxMemorySize

src/backend/common/DefaultMemoryManager.cpp:117–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117void DefaultMemoryManager::setMaxMemorySize() {
118 for (unsigned n = 0; n < memory.size(); n++) {
119 // Calls garbage collection when: total_bytes > memsize * 0.75 when
120 // memsize < 4GB total_bytes > memsize - 1 GB when memsize >= 4GB If
121 // memsize returned 0, then use 1GB
122 size_t memsize = this->getMaxMemorySize(static_cast<int>(n));
123 memory[n].max_bytes =
124 memsize == 0
125 ? ONE_GB
126 : max(memsize * 0.75, static_cast<double>(memsize - ONE_GB));
127 AF_TRACE("memory[{}].max_bytes: {}", n,
128 bytesToString(memory[n].max_bytes));
129 }
130}
131
132float DefaultMemoryManager::getMemoryPressure() {
133 lock_guard_t lock(this->memory_mutex);

Callers 1

initializeMethod · 0.95

Calls 3

bytesToStringFunction · 0.85
maxFunction · 0.50
getMaxMemorySizeMethod · 0.45

Tested by

no test coverage detected