summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2017-03-03 16:35:00 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2017-03-03 09:35:00 -0700
commitda7c751ba7725d9fd71eeff9423ae0e0518baa19 (patch)
tree5ab26fcfe0c2379490c77c00e1f88aff0180a583
parentd9074b295905374434534278524d541c47545347 (diff)
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
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/context.c4
2 files changed, 10 insertions, 0 deletions
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 <msebor@redhat.com>
+
+ PR tree-optimization/79699
+ * context.c (context::~context): Free MPFR caches to avoid
+ a memory leak on program exit.
+
2017-03-03 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* 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 ();
}