[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
This commit is contained in:
Kostya Serebryany 2016-10-06 05:14:00 +00:00
parent bb3823e630
commit 89268017c2
3 changed files with 4 additions and 2 deletions

View File

@ -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]);
}

View File

@ -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)

View File

@ -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\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);
}