]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
common/ceph_context: add an asok command to deliberately leak memory
authorSage Weil <sage@redhat.com>
Wed, 29 Jan 2020 00:15:52 +0000 (18:15 -0600)
committerSage Weil <sage@redhat.com>
Mon, 3 Feb 2020 16:25:39 +0000 (10:25 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
src/common/ceph_context.cc

index 64d58603d6102e1a8d005430c899f82695e6f4ff..5dcdb98d68b10cd79256990882c1029cc788f805 100644 (file)
@@ -484,7 +484,11 @@ int CephContext::_do_command(
       return -EPERM;
     }
   }
-  if (command == "perfcounters_dump" || command == "1" ||
+  if (command == "leak_some_memory") {
+    char *foo = new char[1234];
+    (void)foo;
+  }
+  else if (command == "perfcounters_dump" || command == "1" ||
       command == "perf dump") {
     std::string logger;
     std::string counter;
@@ -685,6 +689,7 @@ CephContext::CephContext(uint32_t module_type_,
   _admin_hook = new CephContextHook(this);
   _admin_socket->register_command("assert", _admin_hook, "");
   _admin_socket->register_command("abort", _admin_hook, "");
+  _admin_socket->register_command("leak_some_memory", _admin_hook, "");
   _admin_socket->register_command("perfcounters_dump", _admin_hook, "");
   _admin_socket->register_command("1", _admin_hook, "");
   _admin_socket->register_command("perf dump name=logger,type=CephString,req=false name=counter,type=CephString,req=false", _admin_hook, "dump perfcounters value");