From da7c751ba7725d9fd71eeff9423ae0e0518baa19 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Fri, 3 Mar 2017 16:35:00 +0000 Subject: [PATCH] PR tree-optimization/79699 - small memory leak in MPFR gcc/ChangeLog: * context.c (context::~context): Free MPFR caches to avoid a memory leak on program exit. From-SVN: r245878 --- gcc/ChangeLog | 6 ++++++ gcc/context.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 03522ced844..d78b3f41d53 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-03-03 Martin Sebor + + PR tree-optimization/79699 + * context.c (context::~context): Free MPFR caches to avoid + a memory leak on program exit. + 2017-03-03 Kyrylo Tkachov * config/aarch64/aarch64.c (aarch64_float_const_representable_p): diff --git a/gcc/context.c b/gcc/context.c index a7ded9c1a62..bacad5a5e77 100644 --- a/gcc/context.c +++ b/gcc/context.c @@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see #include "context.h" #include "pass_manager.h" #include "dumpfile.h" +#include "realmpfr.h" /* The singleton holder of global state: */ gcc::context *g; @@ -42,4 +43,7 @@ gcc::context::~context () { delete m_passes; delete m_dumps; + + /* Release MPFR caches to avoid Valgrind leak reports. */ + mpfr_free_cache (); } -- 2.30.2