Enable --die_on_malloc by default!

All the tests pass, let's pull the trigger and go.

Change-Id: I441a73a19e65fcc78585f4c1ec89223e15c23e02
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/realtime.cc b/aos/realtime.cc
index 2f299e6..d08dd91 100644
--- a/aos/realtime.cc
+++ b/aos/realtime.cc
@@ -20,7 +20,7 @@
 #include "glog/raw_logging.h"
 
 DEFINE_bool(
-    die_on_malloc, false,
+    die_on_malloc, true,
     "If true, die when the application allocates memory in a RT section.");
 DEFINE_bool(skip_realtime_scheduler, false,
             "If true, skip changing the scheduler.  Pretend that we changed "
diff --git a/aos/util/file_test.cc b/aos/util/file_test.cc
index d4382c4..ba03ea5 100644
--- a/aos/util/file_test.cc
+++ b/aos/util/file_test.cc
@@ -7,8 +7,6 @@
 #include "aos/testing/tmpdir.h"
 #include "gtest/gtest.h"
 
-DECLARE_bool(die_on_malloc);
-
 namespace aos {
 namespace util {
 namespace testing {
@@ -52,9 +50,6 @@
 
   FileReader reader(test_file);
 
-  gflags::FlagSaver flag_saver;
-  FLAGS_die_on_malloc = true;
-  RegisterMallocHook();
   aos::ScopedRealtime realtime;
   {
     std::array<char, 20> contents;
@@ -79,9 +74,6 @@
 
   FileWriter writer(test_file);
 
-  gflags::FlagSaver flag_saver;
-  FLAGS_die_on_malloc = true;
-  RegisterMallocHook();
   FileWriter::WriteResult result;
   {
     aos::ScopedRealtime realtime;
@@ -104,9 +96,6 @@
   // Mess up the file management by closing the file descriptor.
   PCHECK(0 == close(writer.fd()));
 
-  gflags::FlagSaver flag_saver;
-  FLAGS_die_on_malloc = true;
-  RegisterMallocHook();
   FileWriter::WriteResult result;
   {
     aos::ScopedRealtime realtime;
diff --git a/frc971/control_loops/drivetrain/localization/puppet_localizer_test.cc b/frc971/control_loops/drivetrain/localization/puppet_localizer_test.cc
index d64c419..e45f880 100644
--- a/frc971/control_loops/drivetrain/localization/puppet_localizer_test.cc
+++ b/frc971/control_loops/drivetrain/localization/puppet_localizer_test.cc
@@ -16,7 +16,6 @@
 
 DEFINE_string(output_folder, "",
               "If set, logs all channels to the provided logfile.");
-DECLARE_bool(die_on_malloc);
 
 namespace frc971 {
 namespace control_loops {
@@ -78,7 +77,6 @@
         drivetrain_plant_(drivetrain_plant_event_loop_.get(),
                           drivetrain_plant_imu_event_loop_.get(), dt_config_,
                           std::chrono::microseconds(500)) {
-    FLAGS_die_on_malloc = true;
     set_team_id(frc971::control_loops::testing::kTeamNumber);
     set_battery_voltage(12.0);
 
diff --git a/y2020/control_loops/drivetrain/localizer_test.cc b/y2020/control_loops/drivetrain/localizer_test.cc
index d280523..9e9e7dd 100644
--- a/y2020/control_loops/drivetrain/localizer_test.cc
+++ b/y2020/control_loops/drivetrain/localizer_test.cc
@@ -15,7 +15,6 @@
 
 DEFINE_string(output_file, "",
               "If set, logs all channels to the provided logfile.");
-DECLARE_bool(die_on_malloc);
 
 // This file tests that the full 2020 localizer behaves sanely.
 
@@ -147,7 +146,6 @@
     CHECK_EQ(aos::configuration::GetNodeIndex(configuration(), pi1_), 1);
     set_team_id(frc971::control_loops::testing::kTeamNumber);
     set_battery_voltage(12.0);
-    FLAGS_die_on_malloc = true;
 
     if (!FLAGS_output_file.empty()) {
       logger_event_loop_ = MakeEventLoop("logger", roborio_);
diff --git a/y2023/localizer/localizer_test.cc b/y2023/localizer/localizer_test.cc
index e8b7d56..2cb5756 100644
--- a/y2023/localizer/localizer_test.cc
+++ b/y2023/localizer/localizer_test.cc
@@ -14,7 +14,6 @@
 
 DEFINE_string(output_folder, "",
               "If set, logs all channels to the provided logfile.");
-DECLARE_bool(die_on_malloc);
 DECLARE_double(max_distance_to_target);
 
 namespace y2023::localizer::testing {
@@ -75,7 +74,6 @@
         status_fetcher_(
             imu_test_event_loop_->MakeFetcher<Status>("/localizer")) {
     FLAGS_max_distance_to_target = 100.0;
-    FLAGS_die_on_malloc = true;
     {
       aos::TimerHandler *timer = roborio_test_event_loop_->AddTimer([this]() {
         {
diff --git a/y2023/y2023_roborio.json b/y2023/y2023_roborio.json
index 13e48dc..8ed9d73 100644
--- a/y2023/y2023_roborio.json
+++ b/y2023/y2023_roborio.json
@@ -339,9 +339,6 @@
     {
       "name": "drivetrain",
       "executable_name": "drivetrain",
-      "args": [
-        "--die_on_malloc"
-      ],
       "nodes": [
         "roborio"
       ]
@@ -349,9 +346,6 @@
     {
       "name": "trajectory_generator",
       "executable_name": "trajectory_generator",
-      "args": [
-        "--die_on_malloc"
-      ],
       "nodes": [
         "roborio"
       ]
@@ -359,9 +353,6 @@
     {
       "name": "superstructure",
       "executable_name": "superstructure",
-      "args": [
-        "--die_on_malloc"
-      ],
       "nodes": [
         "roborio"
       ]
@@ -389,6 +380,9 @@
     {
       "name": "wpilib_interface",
       "executable_name": "wpilib_interface",
+      "args": [
+        "--nodie_on_malloc"
+      ],
       "nodes": [
         "roborio"
       ]