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