From patchwork Sun Jul 11 12:18:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [fortran,committed] Release mpfr caches. From: Mikael Morin X-Patchwork-Id: 58521 Message-Id: <4C39B6A9.8020302@sfr.fr> To: gcc-patches , "fortran@gcc.gnu.org" Date: Sun, 11 Jul 2010 14:18:49 +0200 This fixes a unreleased memory problem present on any testcase as reported by valgrind: ==9351== 32 bytes in 1 blocks are possibly lost in loss record 23 of 286 ==9351== at 0x25A67B: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck-amd64-freebsd.so) ==9351== by 0x20F03B8: __gmp_default_allocate (in /usr/local/lib/libgmp.so.10) ==9351== by 0x1FBF6C5: mpfr_init2 (in /usr/local/lib/libmpfr.so.4) ==9351== by 0x1FCA2BF: mpfr_cache (in /usr/local/lib/libmpfr.so.4) ==9351== by 0x1FA6C58: mpfr_log (in /usr/local/lib/libmpfr.so.4) ==9351== by 0x1FBE43F: mpfr_log10 (in /usr/local/lib/libmpfr.so.4) ==9351== by 0x48EE23: gfc_arith_init_1 (arith.c:168) ==9351== by 0x4F379D: gfc_init_1 (misc.c:260) ==9351== by 0x548854: gfc_init (f95-lang.c:267) ==9351== by 0xA01CC1: lang_dependent_init (toplev.c:2215) ==9351== by 0xA01EDA: do_compile (toplev.c:2339) ==9351== by 0xA01FAA: toplev_main (toplev.c:2381) Index: ChangeLog =================================================================== --- ChangeLog (revision 162057) +++ ChangeLog (revision 162058) @@ -1,3 +1,7 @@ +2010-07-11 Mikael Morin + + * arith.c (gfc_arith_done_1): Release mpfr internal caches. + 2010-07-11 Janus Weil PR fortran/44869 Index: arith.c =================================================================== --- arith.c (revision 162057) +++ arith.c (revision 162058) @@ -260,6 +260,8 @@ gfc_arith_done_1 (void) for (rp = gfc_real_kinds; rp->kind; rp++) mpfr_clears (rp->epsilon, rp->huge, rp->tiny, rp->subnormal, NULL); + + mpfr_free_cache (); }