def set_memory_allocator(
        self, memory_allocator="auto", benchmark=False, skip_list=None
    ):
        """
        Enable TCMalloc/JeMalloc with LD_PRELOAD and set configuration for JeMalloc.
        By default, PTMalloc will be used for PyTorch, but TCMalloc and JeMalloc can get better
        memory resue and reduce page fault to improve performance.
        """
        if skip_list is None:
            skip_list = []
        ma_lib_name = {
            "jemalloc": ["jemalloc", "conda install -c conda-forge jemalloc"],
            "tcmalloc": ["tcmalloc", "conda install -c conda-forge gperftools"],
        }
        ma_local = self.set_lib_bin_from_list(
            memory_allocator,
            ma_lib_name,
            "memory allocator",
            self.ma_supported,
            self.add_lib_preload,
            skip_list=skip_list,
            extra_warning_msg_with_default_choice="This may drop the performance.",
        )
        if ma_local == "jemalloc":
            if benchmark:
                self.add_env(
                    "MALLOC_CONF",
                    "oversize_threshold:1,background_thread:false,metadata_thp:always,dirty_decay_ms:-1,muzzy_decay_ms:-1",
                )
            else:
                self.add_env(
                    "MALLOC_CONF",
                    "oversize_threshold:1,background_thread:true,metadata_thp:auto",
                )
        return ma_local

        Enable TCMalloc/JeMalloc with LD_PRELOAD and set configuration for JeMalloc.
        By default, PTMalloc will be used for PyTorch, but TCMalloc and JeMalloc can get better
        memory resue and reduce page fault to improve performance.
        
intel_extension_for_pytorch/cpu/launch/launcher_base.py