• redis编译问题


    在编译redis时,出现以下问题

    In file included from adlist.c:34:0:
    zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory
     #include <jemalloc/jemalloc.h>
    

      是因为编译redis默认使用的分配器是jemalloc,所以想要解决如上问题的话,有两种方式

      

      第一种 

        yum -y install jemalloc-devel
    

      第二种

        我们可以查看解压之后的redis文件夹,里面有一个README.md

        

        Allocator
        ---------
    
        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
    

      通过查看文件我们可以知道,我们可以使用如下命令,从而使用改变分配器

        make MALLOC=libc    
    

    这两种方法都可以解决上述的问题,希望可以帮到大家。

  • 相关阅读:
    Linux内核架构读书笔记
    Linux内核container_of 宏
    Linux内核架构读书笔记
    Linux内核架构读书笔记
    Linux内核架构读书笔记
    Linux内核架构读书笔记- 2.4.1 进程复制
    作业07:字符串索引与切片
    作业06:数字类型
    作业04:逻辑运算
    作业05:用户登录(三次机会)且每次输入错误显示剩余次数
  • 原文地址:https://www.cnblogs.com/xll970105/p/9894584.html
Copyright © 2020-2023  润新知