Skip to content

Instantly share code, notes, and snippets.

@cbodley
Created August 22, 2016 20:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cbodley/4551b29c50718c230683a6c1d65b326a to your computer and use it in GitHub Desktop.
Save cbodley/4551b29c50718c230683a6c1d65b326a to your computer and use it in GitHub Desktop.
CephContext leak test
#include "common/ceph_argparse.h"
#include "common/common_init.h"
#include "common/config.h"
#include "global/global_init.h"
#include "global/global_context.h"
int main(int argc, const char** argv)
{
std::vector<const char*> args;
argv_to_vec(argc, argv, args);
env_to_vec(args);
const uint32_t module_type = CEPH_ENTITY_TYPE_CLIENT;
const code_environment_t env = CODE_ENVIRONMENT_DAEMON;
const int flags = CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS;
global_init(nullptr, args, module_type, env, flags, "test", true);
common_init_finish(g_ceph_context);
if (g_conf->daemonize) {
global_init_daemonize(g_ceph_context);
}
g_ceph_context->put();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment