mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
lightningd: require explicit LIGHTNINGD_DEV_MEMLEAK env var to do memleak.
Otherwise every allocation and free is slowed down. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
6b9c525f35
commit
e695e5db09
@ -74,7 +74,8 @@ static struct lightningd *new_lightningd(const tal_t *ctx,
|
||||
ld->dev_disconnect_fd = -1;
|
||||
ld->dev_hsm_seed = NULL;
|
||||
ld->dev_subdaemon_fail = false;
|
||||
memleak_init(ld, backtrace_state);
|
||||
if (getenv("LIGHTNINGD_DEV_MEMLEAK"))
|
||||
memleak_init(ld, backtrace_state);
|
||||
#endif
|
||||
|
||||
list_head_init(&ld->peers);
|
||||
|
@ -144,6 +144,10 @@ static void json_memleak(struct command *cmd,
|
||||
{
|
||||
struct json_result *response = new_json_result(cmd);
|
||||
|
||||
if (!getenv("LIGHTNINGD_DEV_MEMLEAK"))
|
||||
command_fail(cmd,
|
||||
"Leak detection needs $LIGHTNINGD_DEV_MEMLEAK");
|
||||
|
||||
json_object_start(response, NULL);
|
||||
scan_mem(cmd, response, cmd->ld);
|
||||
json_object_end(response);
|
||||
|
@ -108,6 +108,7 @@ class NodeFactory(object):
|
||||
daemon.cmd_line.append("--dev-disconnect=dev_disconnect")
|
||||
if DEVELOPER:
|
||||
daemon.cmd_line.append("--dev-fail-on-subdaemon-fail")
|
||||
daemon.env["LIGHTNINGD_DEV_MEMLEAK"] = "1"
|
||||
if VALGRIND:
|
||||
daemon.env["LIGHTNINGD_DEV_NO_BACKTRACE"] = "1"
|
||||
opts = [] if options is None else options
|
||||
|
Loading…
Reference in New Issue
Block a user