https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85192
Bug ID: 85192 Summary: Memory leak on every read() from string Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: Vasilis.Vlachoudis at cern dot ch Target Milestone: --- Every "READ(line,*) vars" statement from a string has a memory leak. Example real*8 x, y, z, u, v, w, erg, tme, wgt character*250 line line='1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10' nstart = meminfo() do i=1,10 read(line,*) x,y,z,u,v,w,erg,tme,wgt,ij * print *, x,y,z,u,v,w,erg,tme,wgt,ij print *,meminfo()-nstart enddo end Compiled together with meminfo.c #include <malloc.h> int meminfo_() { struct mallinfo mi; mi = mallinfo(); return mi.uordblks; } /* meminfo_ */ It will return a constantly increasing heap size gcc -c meminfo.c $ gfortran test.f meminfo.o $ a.out 3296 4320 5344 6368 7392 8416 9440 10368 11296 12224