在执行该命令时报下列错误

[root@ ~]# valgrind --tool=memcheck ./run
==2932== Memcheck, a memory error detector
==2932== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==2932== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==2932== Command: ./run
==2932==
./run: line 56: ulimit: open files: cannot modify limit: 不允许的操作

 

修改该文件

[root@ ~]# vim /etc/security/limits.conf

*                soft nofile            65535
*                hard nofile            65535
*                soft nproc             65535
*                hard nproc             65535

 

问题解决

[root@ ~]# valgrind --tool=memcheck ./run
==2401== Memcheck, a memory error detector
==2401== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==2401== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==2401== Command: ./run
==2401==