Microsoft KB Archive/105932
Article ID: 105932
Article Last Modified on 10/2/2003
- Microsoft FORTRAN PowerStation 1.0 Standard Edition
- Microsoft Fortran PowerStation 1.0a for MS-DOS
This article was previously published under Q105932
Character string concatenations that involve the automatic creation of temporary variables may cause the following memory related run-time problems:
- Very slow execution of the application
This memory loss can be avoided by assigning the concatenated strings to a temporary character string variable.
Microsoft has confirmed this to be a problem in FORTRAN PowerStation version 1.0. This problem has been resolved with FORTRAN PowerStation maintenance release version 1.0a for MS-DOS.
FORTRAN PowerStation version 1.0 can be differentiated from the maintenance release version 1.0a by invoking the linker. Typing "link32 | more" from \F32\BIN directory will show version 2.8 for FORTRAN PowerStation version 1.0, and it will show version 1.0f for the maintenance release version 1.0a.
The following two sample programs demonstrate a memory loss due to string concatenation in the argument list. In both of the following examples, using a temporary variable for the concatenated strings avoids the memory leak.
Sample Code 1
C Compile options needed: none character*40 c1,c2 c1 = 'abcd' c2 = 'efgh' k = 0 do i=1,500000 if(c1//c2 .eq. 'Never') k = k + 1 end do end
The code above will run very slowly, and eventually generate:
Sample Code 2
C Compile options needed: none character fmtout*20,label(1,3)*(9) double precision value data (label(1,j),j=1,3)/' Label',' Output',' Test'/ data value/3.14159/ fmtout='f10.3' write(6,'(3a,''='','//fmtout//')')(label(1,j),j=1,3),value end
The above code on execution will generate:
The code does run to completion because this type of DOS-extender error is not fatal.
Additional query words: 1.00 buglist1.00 fixlist1.00a
Keywords: kbbug kbfix KB105932