[llvm] r283418 - [libFuzzer] be more careful with memory usage, print peak rss in status lines

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 5 22:14:01 PDT 2016


Author: kcc
Date: Thu Oct  6 00:14:00 2016
New Revision: 283418

URL: http://llvm.org/viewvc/llvm-project?rev=283418&view=rev
Log:
[libFuzzer] be more careful with memory usage, print peak rss in status lines

Modified:
    llvm/trunk/lib/Fuzzer/FuzzerCorpus.h
    llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp
    llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp

Modified: llvm/trunk/lib/Fuzzer/FuzzerCorpus.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerCorpus.h?rev=283418&r1=283417&r2=283418&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerCorpus.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerCorpus.h Thu Oct  6 00:14:00 2016
@@ -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]);
         }

Modified: llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp?rev=283418&r1=283417&r2=283418&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp Thu Oct  6 00:14:00 2016
@@ -516,6 +516,7 @@ int FuzzerDriver(int *argc, char ***argv
       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)

Modified: llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp?rev=283418&r1=283417&r2=283418&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp Thu Oct  6 00:14:00 2016
@@ -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 *Wher
     Printf(" units: %zd", Units);
 
   Printf(" exec/s: %zd", ExecPerSec);
+  Printf(" rss: %zdMb", GetPeakRSSMb());
   Printf("%s", End);
 }
 




More information about the llvm-commits mailing list