public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40508]  New: memory leak in internal write of gfortran
@ 2009-06-21  3:09 alain dot hebert at polymtl dot ca
  2009-06-21  4:15 ` [Bug fortran/40508] " kargl at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: alain dot hebert at polymtl dot ca @ 2009-06-21  3:09 UTC (permalink / raw)
  To: gcc-bugs

alain-heberts-macbook-pro:~ alainhebert$ gfortran -v
Using built-in specs.
Target: i386-apple-darwin8.10.1
Configured with: /tmp/gfortran-20090604/ibin/../gcc/configure
--prefix=/usr/local/gfortran --enable-languages=c,fortran
--with-gmp=/tmp/gfortran-20090604/gfortran_libs --enable-bootstrap
Thread model: posix
gcc version 4.5.0 20090604 (experimental) [trunk revision 148180] (GCC) 

There is a memory leak in the latest build of gfortran. This leak is related to
the internal write operation. The bug occurs when there is no memory left (it
can be long...).

Here is the code:
      character hmg1*52,hmg2*52
      integer idata(13)
      hmg1='1234567890123456789012345678901234567890123456789012'
      read(hmg1,'(13A4)') (idata(ii),ii=1,13)
      do i=1,100
         do j=1,10000000
            write(hmg2,'(13A4)') (idata(ii),ii=1,13)
         enddo
         print *,i,hmg2
      enddo
      print *,'everything OK'
      stop
      end

Here is the output:
(cut...)
          21 1234567890123456789012345678901234567890123456789012
          22 1234567890123456789012345678901234567890123456789012
a.out(96109) malloc: *** mmap(size=2097152) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
Operating system error: Cannot allocate memory
Memory allocation failed


-- 
           Summary: memory leak in internal write of gfortran
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: alain dot hebert at polymtl dot ca


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40508


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/40508] memory leak in internal write of gfortran
  2009-06-21  3:09 [Bug fortran/40508] New: memory leak in internal write of gfortran alain dot hebert at polymtl dot ca
@ 2009-06-21  4:15 ` kargl at gcc dot gnu dot org
  2009-06-21 10:51 ` dominiq at lps dot ens dot fr
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: kargl at gcc dot gnu dot org @ 2009-06-21  4:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from kargl at gcc dot gnu dot org  2009-06-21 04:14 -------
Fortran bugs are never marked with a Severity of Critical unless
the bug is breaking bootstrap.  Reset Severity to Normal.


-- 

kargl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40508


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/40508] memory leak in internal write of gfortran
  2009-06-21  3:09 [Bug fortran/40508] New: memory leak in internal write of gfortran alain dot hebert at polymtl dot ca
  2009-06-21  4:15 ` [Bug fortran/40508] " kargl at gcc dot gnu dot org
@ 2009-06-21 10:51 ` dominiq at lps dot ens dot fr
  2009-06-21 12:58 ` jvdelisle at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dominiq at lps dot ens dot fr @ 2009-06-21 10:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dominiq at lps dot ens dot fr  2009-06-21 10:51 -------
Confirmed on i686-apple-darwin9 revision 148750: replacing 10000000 by 1000000,
the memory usage increases by ~1.5Gb. This is a regression: I don't see the
memory increase on 4.4.0, 4.4.1 r147906 (i.e., before the format caching was
disabled IIRC) and 4.5.0 r147428. AFAICT this is a bug in the library: using
the executable from r147428 with the library from r148750 exhibits the memory
leak.


-- 

dominiq at lps dot ens dot fr changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jb at gcc dot gnu dot org,
                   |                            |jvdelisle at verizon dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40508


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/40508] memory leak in internal write of gfortran
  2009-06-21  3:09 [Bug fortran/40508] New: memory leak in internal write of gfortran alain dot hebert at polymtl dot ca
  2009-06-21  4:15 ` [Bug fortran/40508] " kargl at gcc dot gnu dot org
  2009-06-21 10:51 ` dominiq at lps dot ens dot fr
@ 2009-06-21 12:58 ` jvdelisle at gcc dot gnu dot org
  2009-06-21 17:13 ` kargl at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-06-21 12:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jvdelisle at gcc dot gnu dot org  2009-06-21 12:58 -------
I see no memory issues or memory growth on x85-64-linux-gnu with -m64 or -m32. 
This appears to be target specific.  Checked with 4.4.1 and latest trunk.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40508


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/40508] memory leak in internal write of gfortran
  2009-06-21  3:09 [Bug fortran/40508] New: memory leak in internal write of gfortran alain dot hebert at polymtl dot ca
                   ` (2 preceding siblings ...)
  2009-06-21 12:58 ` jvdelisle at gcc dot gnu dot org
@ 2009-06-21 17:13 ` kargl at gcc dot gnu dot org
  2009-06-21 17:35 ` jvdelisle at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: kargl at gcc dot gnu dot org @ 2009-06-21 17:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from kargl at gcc dot gnu dot org  2009-06-21 17:12 -------
(In reply to comment #3)
> I see no memory issues or memory growth on x85-64-linux-gnu with -m64 or -m32. 
> This appears to be target specific.  Checked with 4.4.1 and latest trunk.
> 

I think there is a leak.  After 3 iterations, I have

REMOVE:kargl[67] ./z
           1 1234567890123456789012345678901234567890123456789012
           2 1234567890123456789012345678901234567890123456789012
           3 1234567890123456789012345678901234567890123456789012

last pid: 17063;  load averages:  0.93,  0.52,  0.34    up 0+17:51:38  10:09:24
44 processes:  2 running, 42 sleeping
CPU: 45.1% user,  0.0% nice,  5.6% system,  0.0% interrupt, 49.3% idle
Mem: 299M Active, 438M Inact, 198M Wired, 39M Cache, 110M Buf, 11M Free
Swap: 1024M Total, 60M Used, 964M Free, 5% Inuse

  PID USERNAME    THR PRI NICE   SIZE    RES STATE   C   TIME    CPU COMMAND
17063 kargl         1 119    0   247M   246M CPU1    0   2:30 100.34% z

With each iteration, the SIZE grows by about 80M.

Anyone have valgrind?  Last I checked, algrind did not run on FreeBSD.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40508


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/40508] memory leak in internal write of gfortran
  2009-06-21  3:09 [Bug fortran/40508] New: memory leak in internal write of gfortran alain dot hebert at polymtl dot ca
                   ` (3 preceding siblings ...)
  2009-06-21 17:13 ` kargl at gcc dot gnu dot org
@ 2009-06-21 17:35 ` jvdelisle at gcc dot gnu dot org
  2009-06-21 18:50 ` jvdelisle at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-06-21 17:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jvdelisle at gcc dot gnu dot org  2009-06-21 17:34 -------
I don't doubt there is a problem.  Not found with valgrind either on x86-64
linux.

It's hard to debug when you can't see the problem.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40508


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/40508] memory leak in internal write of gfortran
  2009-06-21  3:09 [Bug fortran/40508] New: memory leak in internal write of gfortran alain dot hebert at polymtl dot ca
                   ` (4 preceding siblings ...)
  2009-06-21 17:35 ` jvdelisle at gcc dot gnu dot org
@ 2009-06-21 18:50 ` jvdelisle at gcc dot gnu dot org
  2009-06-22 11:55 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-06-21 18:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jvdelisle at gcc dot gnu dot org  2009-06-21 18:50 -------
Confirmed.  Problem narrowed down to format hashing not getting freed by Richi
on IRC.  I had the problem bypassed on my trunk by another patch.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jvdelisle at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-06-21 18:50:10
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40508


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/40508] memory leak in internal write of gfortran
  2009-06-21  3:09 [Bug fortran/40508] New: memory leak in internal write of gfortran alain dot hebert at polymtl dot ca
                   ` (5 preceding siblings ...)
  2009-06-21 18:50 ` jvdelisle at gcc dot gnu dot org
@ 2009-06-22 11:55 ` burnus at gcc dot gnu dot org
  2009-06-23  0:16 ` jvdelisle at gcc dot gnu dot org
  2009-07-09  2:03 ` jvdelisle at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-06-22 11:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from burnus at gcc dot gnu dot org  2009-06-22 11:55 -------
Jerry's patch: http://gcc.gnu.org/ml/fortran/2009-06/msg00233.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40508


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/40508] memory leak in internal write of gfortran
  2009-06-21  3:09 [Bug fortran/40508] New: memory leak in internal write of gfortran alain dot hebert at polymtl dot ca
                   ` (6 preceding siblings ...)
  2009-06-22 11:55 ` burnus at gcc dot gnu dot org
@ 2009-06-23  0:16 ` jvdelisle at gcc dot gnu dot org
  2009-07-09  2:03 ` jvdelisle at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-06-23  0:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jvdelisle at gcc dot gnu dot org  2009-06-23 00:16 -------
Subject: Bug 40508

Author: jvdelisle
Date: Tue Jun 23 00:16:24 2009
New Revision: 148823

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=148823
Log:
2009-06-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libfortran/40508
        * io/format.c: Don't save parsed format data for internal units.

Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/format.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40508


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/40508] memory leak in internal write of gfortran
  2009-06-21  3:09 [Bug fortran/40508] New: memory leak in internal write of gfortran alain dot hebert at polymtl dot ca
                   ` (7 preceding siblings ...)
  2009-06-23  0:16 ` jvdelisle at gcc dot gnu dot org
@ 2009-07-09  2:03 ` jvdelisle at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-07-09  2:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jvdelisle at gcc dot gnu dot org  2009-07-09 02:02 -------
Fixed.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40508


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-07-09  2:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-21  3:09 [Bug fortran/40508] New: memory leak in internal write of gfortran alain dot hebert at polymtl dot ca
2009-06-21  4:15 ` [Bug fortran/40508] " kargl at gcc dot gnu dot org
2009-06-21 10:51 ` dominiq at lps dot ens dot fr
2009-06-21 12:58 ` jvdelisle at gcc dot gnu dot org
2009-06-21 17:13 ` kargl at gcc dot gnu dot org
2009-06-21 17:35 ` jvdelisle at gcc dot gnu dot org
2009-06-21 18:50 ` jvdelisle at gcc dot gnu dot org
2009-06-22 11:55 ` burnus at gcc dot gnu dot org
2009-06-23  0:16 ` jvdelisle at gcc dot gnu dot org
2009-07-09  2:03 ` jvdelisle at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).