diff options
Diffstat (limited to 'src/allocators.py')
| -rw-r--r-- | src/allocators.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/allocators.py b/src/allocators.py new file mode 100644 index 0000000..dbf26d1 --- /dev/null +++ b/src/allocators.py @@ -0,0 +1,22 @@ +"""Default allocators using system libraries""" + +import os +import subprocess + +maybe_allocators = ["tcmalloc", "jemalloc", "hoard"] + +allocators = {"libc": {"cmd_prefix" : "", + "binary_suffix" : "", + "LD_PRELOAD" : "", + "color" : "C1"}} + +for i, t in enumerate(maybe_allocators): + try: + path = subprocess.check_output('whereis lib{} | cut -d":" -f2'.format(t), + shell=True, text=True).strip() + + if path != "": + allocators[t] = {"cmd_prefix": "", "binary_suffix": "", + "LD_PRELOAD": path, "color": "C"+str(i+2)} + except: + pass |
