diff options
-rw-r--r-- | DOCS/tech-overview.txt | 1 | ||||
-rw-r--r-- | player/main.c | 4 | ||||
-rw-r--r-- | wscript | 7 |
3 files changed, 11 insertions, 1 deletions
diff --git a/DOCS/tech-overview.txt b/DOCS/tech-overview.txt index b614d08389..8d75adfff3 100644 --- a/DOCS/tech-overview.txt +++ b/DOCS/tech-overview.txt @@ -68,6 +68,7 @@ ta.h & ta.c: as in it doesn't require valgrind.) You can enable it by setting the MPV_LEAK_REPORT environment variable to "1": export MPV_LEAK_REPORT=1 + Or permanently by building with --enable-ta-leak-report. This will list all unfree'd allocations on exit. Documentation can be found here: diff --git a/player/main.c b/player/main.c index 8894988e99..1c8c8014b1 100644 --- a/player/main.c +++ b/player/main.c @@ -266,7 +266,9 @@ struct MPContext *mp_create(void) } char *enable_talloc = getenv("MPV_LEAK_REPORT"); - if (enable_talloc && strcmp(enable_talloc, "1") == 0) + if (!enable_talloc) + enable_talloc = HAVE_TA_LEAK_REPORT ? "1" : "0"; + if (strcmp(enable_talloc, "1") == 0) talloc_enable_leak_report(); mp_time_init(); @@ -81,6 +81,13 @@ build_options = [ 'default': 'disable', 'func': check_true }, { + # Reminder: normally always built, but enabled by MPV_LEAK_REPORT. + # Building it can be disabled only by defining NDEBUG through CFLAGS. + 'name': '--ta-leak-report', + 'desc': 'enable ta leak report by default (development only)', + 'default': 'disable', + 'func': check_true + }, { 'name': '--manpage-build', 'desc': 'manpage generation', 'func': check_ctx_vars('RST2MAN') |