zoukankan      html  css  js  c++  java
  • Linux安装redis报错:jemalloc/jemalloc.h: No such file or directory踩坑

    报错内容:

     针对这个错误,我们可以在README.md 文件中看到解释:

    ---------
    
    Selecting a non-default memory allocator when building Redis is done by setting
    the `MALLOC` environment variable. Redis is compiled and linked against libc
    malloc by default, with the exception of jemalloc being the default on Linux
    systems. This default was picked because jemalloc has proven to have fewer
    fragmentation problems than libc malloc.
    
    To force compiling against libc malloc, use:
    
        % make MALLOC=libc
    
    To compile against jemalloc on Mac OS X systems, use:
    
        % make MALLOC=jemalloc
    
    Verbose build
    -------------
    

      网上大部分解决办法都是错误的,如下文:

    make MALLOC=libc
    

      正确解决办法(针对2.2以上的版本)
    清理上次编译残留文件,重新编译:

    make distclean  && make

    错误的本质是我们在开始执行make 时遇到了错误(大部分是由于gcc未安装),然后我们安装好了gcc 后,我们再执行make ,这时就出现了jemalloc/jemalloc.h: No such file or directory。这是因为上次的

    编译失败,有残留的文件,我们需要清理下,然后重新编译就可以了。

    网上的解决办法虽然最后也是可以成功安装好 redis ,但是是有一些隐患的,首先我们要知道redis 需要使用内存分配器的, make MALLOC=jemalloc 就是指定内存分配器为 jemalloc ,make MALLOC=libc 就是指定内存分配器为 libc ,这个是有安全隐患的,jemalloc 内存分配器在实践中处理内存碎片是要比libc 好的,而且在README.md 文档也说明到了,jemalloc内存分配器也是包含在源码包里面的,可以在deps 目录下看到 jemalloc 目录。

  • 相关阅读:
    Dubbo集群配置和官方文档
    Lock wait timeout exceeded
    Too many connections
    mybatis 批量更新 Parameter '__frch_item_0' not found. Available parameters are [list]
    base64文件转MultipartFile文件
    base64之js压缩图片
    NotSupportedError Only secure origins are allowed
    安装MySQL时候最后一步报无法定位程序输入点fesetround于动态链接库MSVCR120.dll
    2018年总结
    java开发之多线程基础篇
  • 原文地址:https://www.cnblogs.com/Courage129/p/13706750.html
Copyright © 2011-2022 走看看