메모리 누수를 감지하기 위해 mips32 시스템에서 Valgrind를 실행하려고합니다. 사용 가능한 총 메모리는 32MB입니다 (SWAP 사용 안 함). 문제는 Valgrind 자체가 필요한 메모리 양을 할당 할 수없고 항상 "메모리 부족"오류가 발생한다는 것입니다.메모리 제한을 Valgrind로 설정하십시오.
[email protected]# valgrind --leak-check=yes grep -r "foo" /etc/config/
==9392== Memcheck, a memory error detector
==9392== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==9392== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==9392== Command: grep -r foo /etc/config/
==9392==
==9392==
==9392== Valgrind's memory management: out of memory:
==9392== initialiseSector(TC)'s request for 27597024 bytes failed.
==9392== 20516864 bytes have already been allocated.
==9392== Valgrind cannot continue. Sorry.
==9392==
==9392== There are several possible reasons for this.
==9392== - You have some kind of memory limit in place. Look at the
==9392== output of 'ulimit -a'. Is there a limit on the size of
==9392== virtual memory or address space?
==9392== - You have run out of swap space.
==9392== - Valgrind has a bug. If you think this is the case or you are
==9392== not sure, please let us know and we'll try to fix it.
==9392== Please note that programs can take substantially more memory than
==9392== normal when running under Valgrind tools, eg. up to twice or
==9392== more, depending on the tool. On a 64-bit machine, Valgrind
==9392== should be able to make use of up 32GB memory. On a 32-bit
==9392== machine, Valgrind should be able to use all the memory available
==9392== to a single process, up to 4GB if that's how you have your
==9392== kernel configured. Most 32-bit Linux setups allow a maximum of
==9392== 3GB per process.
==9392==
==9392== Whatever the reason, Valgrind cannot continue. Sorry.
Valgrind가 할당하는 메모리 양을 제한 할 수 있는지 궁금합니다. 나는 --max-stacksize와 --max-stackframe을 가지고 놀려고했지만 결과는 항상 같습니다.
Valgrind의 메모리 제한을 늘리려면이 게시물을 확인하십시오. http://sourceforge.net/p/valgrind/mailman/message/27779126/ 기본적으로 동일한 작업을 수행하면 제한을 낮출 수 있습니다. –
32MB가 너무 작습니다. OS 및 다른 프로세스가 메모리를 필요로한다고 가정하고 valgrind가 작동하도록하기 위해 앱을 많이 사용하지 않는 앱이 필요합니다. –