From: Kostya Serebryany Date: Thu, 6 Oct 2016 05:14:00 +0000 (+0000) Subject: [libFuzzer] be more careful with memory usage, print peak rss in status lines X-Git-Tag: android-x86-7.1-r4~26183 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=89268017c205effc04c3017e748b365c46d47d30;p=android-x86%2Fexternal-llvm.git [libFuzzer] be more careful with memory usage, print peak rss in status lines git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283418 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Fuzzer/FuzzerCorpus.h b/lib/Fuzzer/FuzzerCorpus.h index a46f1dccb45..382980b9fee 100644 --- a/lib/Fuzzer/FuzzerCorpus.h +++ b/lib/Fuzzer/FuzzerCorpus.h @@ -123,7 +123,7 @@ class InputCorpus { assert(II.NumFeatures > 0); II.NumFeatures--; if (II.NumFeatures == 0) { - II.U.clear(); + Unit().swap(II.U); if (FeatureDebug) Printf("EVICTED %zd\n", SmallestElementPerFeature[Idx]); } diff --git a/lib/Fuzzer/FuzzerDriver.cpp b/lib/Fuzzer/FuzzerDriver.cpp index fd88d50cfa8..336bdf0f859 100644 --- a/lib/Fuzzer/FuzzerDriver.cpp +++ b/lib/Fuzzer/FuzzerDriver.cpp @@ -516,6 +516,7 @@ int FuzzerDriver(int *argc, char ***argv, UserCallback Callback) { Printf("INFO: A corpus is not provided, starting from an empty corpus\n"); } F.ShuffleAndMinimize(&InitialCorpus); + InitialCorpus.clear(); // Don't need this memory any more. F.Loop(); if (Flags.verbosity) diff --git a/lib/Fuzzer/FuzzerLoop.cpp b/lib/Fuzzer/FuzzerLoop.cpp index a1772412a32..49b58ddf5d5 100644 --- a/lib/Fuzzer/FuzzerLoop.cpp +++ b/lib/Fuzzer/FuzzerLoop.cpp @@ -274,7 +274,7 @@ void Fuzzer::RssLimitCallback() { GetPid(), GetPeakRSSMb(), Options.RssLimitMb); Printf(" To change the out-of-memory limit use -rss_limit_mb=\n\n"); if (EF->__sanitizer_print_memory_profile) - EF->__sanitizer_print_memory_profile(50); + EF->__sanitizer_print_memory_profile(95); DumpCurrentUnit("oom-"); Printf("SUMMARY: libFuzzer: out-of-memory\n"); PrintFinalStats(); @@ -324,6 +324,7 @@ void Fuzzer::PrintStats(const char *Where, const char *End, size_t Units) { Printf(" units: %zd", Units); Printf(" exec/s: %zd", ExecPerSec); + Printf(" rss: %zdMb", GetPeakRSSMb()); Printf("%s", End); }