Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28181 Discussions

Leaked mutant (mutex) handles during formatted write

I'm using the ifort compiler, version 16.0 Build 20150815. In my long-running program (2-3 days) I'm doing quite some formatted writes along the lines of: CHARACTER(1024) :: c_string WRITE (c_string, '(2X,A8,I2,F9.1)') parent%sub%c_a_string, parent%sub%i_an_integer, d_a_double and use the result for output e.g. to the screen. Every time I'm doing this, a mutant (mutex) handle is leaked. I used WinDbg's !htrace -diff function to get traces of the incidents. What I get are loads of traces similar to this one: 0x00000000777ca25a: ntdll!NtCreateMutant+0x000000000000000a 0x000007fefd54a1b7: KERNELBASE!CreateMutexExW+0x0000000000000057 0x000007fefd551d60: KERNELBASE!CreateMutexExA+0x0000000000000050 0x000007fedfab24db: libifcoremd!for_lge_ssll+0x0000000000001dcb 0x000007fedfb03ed6: libifcoremd!for_write_int_fmt+0x0000000000000056 0x000000014085aa21: myprog!MY_ROUTINE+0x0000000000000121 During the runtime, these leaked mutant handles pile up until they reach the number 16711680. When the program is finally at the point of writing stuff to a file, the attempt to get a file handle fails with the error: 0x000005aa ERROR_NO_SYSTEM_RESOURCES : Insufficient system resources exist to complete the requested service. (The file is created but the file handle, I get from fopen is NULL) It seems that the handle leaking is happening inside some Intel libraries. Is this a known problem? Is it maybe fixed in a version later than 16.0? Is there anything I can do to circumvent the handle leaking? I found something which seems somewhat related, only it's describing memory leaks during using the WRITE function:
0 Kudos
1 Reply
New Contributor I

Have a look at this thread:

The issue should be fixed in newer IVF compiler versions, including updates of version 16.


0 Kudos