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