Memory leak with WRITE operation on an internal file (variable of CHARACTER type)

Memory leak with WRITE operation on an internal file (variable of CHARACTER type)

Consider the following trivially simple program :

PROGRAM p

   IMPLICIT NONE

   !.. Local variables
   CHARACTER(LEN=2) :: StrBuffer
   INTEGER :: I

   I = 1   
   WRITE(StrBuffer, FMT='(I2)') I

   !..
   STOP

END PROGRAM p

When the code is compiled with Intel Fortran (version 14 or 2015 Beta) and the program is executed, Dr Memory utility indicates there is a memory leak associated with the WRITE statement.  The output generated by the utility is as follows:

         Dr. Memory version 1.7.0
         Running "Debug\TestFor32.exe"
         
         Error #1: LEAK 12 bytes 
         replace_malloc 
             d:\drmemory_package\common\alloc_replace.c(2320):
         for__get_vm  
             ??:0
         for__acquire_lun
             ??:0
         for_write_int_fmt
             ??:0
         P            
             TestFor.f90(10):
         main         
             ??:0
         
         ERRORS FOUND:
               0 unique,     0 total unaddressable access(es)
               0 unique,     0 total uninitialized access(es)
               0 unique,     0 total invalid heap argument(s)
               0 unique,     0 total GDI usage error(s)
               0 unique,     0 total handle leak(s)
               0 unique,     0 total warning(s)
               1 unique,     1 total,     12 byte(s) of leak(s)
               0 unique,     0 total,      0 byte(s) of possible leak(s)
         Details: C:\..\DrMemory-TestFor32.exe.4680.000\results.txt

Can someone at Intel please investigate and provide feedback on this memory leak?  In one of my codes, such a WRITE operation on an internal file can occur many times and there are some performance issues with this code, hence I appreciate any clarification any one can provide.

Thanks,

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

FWIW, when the above example is compiled and executed with gfortran 4.9, one gets the following:

Dr. Memory version 1.7.0 build 5 built on Apr  4 2014 23:38:05
Dr. Memory results for pid 1652: "TestFor.exe"
Application cmdline: "Debug\GNU\TestFor.exe -show_reachable"

===========================================================================
FINAL SUMMARY:

DUPLICATE ERROR COUNTS:

SUPPRESSIONS USED:

NO ERRORS FOUND:
      0 unique,     0 total unaddressable access(es)
      0 unique,     0 total uninitialized access(es)
      0 unique,     0 total invalid heap argument(s)
      0 unique,     0 total GDI usage error(s)
      0 unique,     0 total handle leak(s)
      0 unique,     0 total warning(s)
      0 unique,     0 total,      0 byte(s) of leak(s)
      0 unique,     0 total,      0 byte(s) of possible leak(s)
Details: C:\..\DrMemory-TestFor.exe.1652.000\results.txt

 

Steve Lionel (Intel)'s picture

Yep, we know about this one and recently fixed it. The fix should be in the final 15.0 release.

Steve

Quote:

Steve Lionel (Intel) wrote:

Yep, we know about this one and recently fixed it. The fix should be in the final 15.0 release.

Excellent, thanks!

Login to leave a comment.