MCPcopy Create free account
hub / github.com/apache/mesos / updateJemallocSetting

Function updateJemallocSetting

3rdparty/libprocess/src/memory_profiler.cpp:216–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214// Returns an error on failure or the previous value on success.
215template<typename T>
216Try<T> updateJemallocSetting(const char* name, const T& value)
217{
218#ifdef LIBPROCESS_ALLOW_JEMALLOC
219 if (!detectJemalloc()) {
220 return Error(JEMALLOC_NOT_DETECTED_MESSAGE);
221 }
222
223 T previous;
224 size_t size = sizeof(previous);
225 int error = ::mallctl(
226 name, &previous, &size, const_cast<T*>(&value), sizeof(value));
227
228 if (error) {
229 return Error(strings::format(
230 "Couldn't write value %s for option %s: %s",
231 stringify(value), name, ::strerror(error)).get());
232 }
233
234 return previous;
235#else
236 UNREACHABLE();
237#endif
238}
239
240
241// Sadly, we cannot just use `updateJemallocSetting()` and ignore the result,

Callers 2

startProfilingFunction · 0.85
stopProfilingFunction · 0.85

Calls 6

detectJemallocFunction · 0.85
formatFunction · 0.85
strerrorFunction · 0.85
ErrorClass · 0.50
stringifyClass · 0.50
getMethod · 0.45

Tested by

no test coverage detected