MCPcopy Create free account
hub / github.com/avast/retdec / getTotalSystemMemoryOnBSD

Function getTotalSystemMemoryOnBSD

src/utils/memory.cpp:143–149  ·  view source on GitHub ↗

* @brief Implementation of @c getTotalSystemMemory() on *BSD. * * AKA FreeBSD, DragonFly, NetBSD, OpenBSD, TrueOS, PCBSD */

Source from the content-addressed store, hash-verified

141* AKA FreeBSD, DragonFly, NetBSD, OpenBSD, TrueOS, PCBSD
142*/
143std::size_t getTotalSystemMemoryOnBSD() {
144 int what[] = { CTL_HW, HW_PHYSMEM };
145 std::size_t value = 0;
146 std::size_t length = sizeof(value);
147 auto rc = sysctl(what, 2, &value, &length, nullptr, 0);
148 return rc != -1 ? value : 0;
149}
150
151/**
152* @brief Implementation of @c limitSystemMemory() on *BSD.

Callers 1

getTotalSystemMemoryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected