This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Based on https://www.flamingbytes.com/blog/cgroups-limit-memory/ | |
Install prerequisites: | |
$ apt install libcgroup libcgroup-tools | |
Create new group: | |
$ cgcreate -g memory:/memlimited | |
Set limit: | |
$ echo 32G > /sys/fs/cgroup/memory/memlimited/memory.limit_in_bytes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T> | |
const T &min(const T &a, const T &b) { | |
return b < a ? b : a; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build llvm | |
cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \ | |
-DLLVM_USE_SANITIZER="MemoryWithOrigins" | |
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo -G Ninja \ | |
-S runtimes -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \ | |
path/to/llvm | |
ninja -j32 install-cxx install-cxxabi |