Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
89 Views

ifort fatal error lnk 1248 image size (CAB9600) larger than max 80000000

Jump to solution

I realize the problem with this most likely is a large array on the stack - that I need to move to allocate. But is there any way to find which array this is? the program is several hundred subs with over 100k LOC. Any help. works fine in *nix

I am in visual studio environ, with intel vis fortran. 

Also, I am in x64, I have enable large memory aware, set link optimization heap to 0. 

What else can I try? 

 

thanks

0 Kudos

Accepted Solutions
Highlighted
Black Belt Retired Employee
89 Views

This is not a stack array, it's a large, statically declared array, likely in COMMON. The individual array won't be over 2GB , because the compiler would tell you if it was, but if multiple arrays are large, you can also hit the limit.

The Windows 2GB limit on static code and data is baked into the EXE file format and can't be worked around, even on x64. See https://software.intel.com/en-us/articles/memory-limits-applications-windows

You can generate a link map and it will tell you the sizes of the various contributions. A compiler listing will also tell you array sizes. But first take a look at COMMON declarations and look for very large arrays.

View solution in original post

0 Kudos
5 Replies
Highlighted
Black Belt Retired Employee
90 Views

This is not a stack array, it's a large, statically declared array, likely in COMMON. The individual array won't be over 2GB , because the compiler would tell you if it was, but if multiple arrays are large, you can also hit the limit.

The Windows 2GB limit on static code and data is baked into the EXE file format and can't be worked around, even on x64. See https://software.intel.com/en-us/articles/memory-limits-applications-windows

You can generate a link map and it will tell you the sizes of the various contributions. A compiler listing will also tell you array sizes. But first take a look at COMMON declarations and look for very large arrays.

View solution in original post

0 Kudos
Highlighted
New Contributor II
89 Views

Steve Lionel (Ret.) (Blackbelt) wrote:

This is not a stack array, it's a large, statically declared array, likely in COMMON. The individual array won't be over 2GB , because the compiler would tell you if it was, but if multiple arrays are large, you can also hit the limit.

The Windows 2GB limit on static code and data is baked into the EXE file format and can't be worked around, even on x64. See https://software.intel.com/en-us/articles/memory-limits-applications-win...

You can generate a link map and it will tell you the sizes of the various contributions. A compiler listing will also tell you array sizes. But first take a look at COMMON declarations and look for very large arrays.

Yes this is a problem 

0 Kudos
Highlighted
Beginner
89 Views

Steve Lionel (Ret.) (Blackbelt) wrote:

You can generate a link map and it will tell you the sizes of the various contributions. A compiler listing will also tell you array sizes. But first take a look at COMMON declarations and look for very large arrays.

Do you have any references that can help with this (making and using a linkmap or the compiler listing you mentioned). The plan is to migrate over to modules and dynamic allocation now, but I need to do so in a way that will give us a working exe faster - Ie without having to convert every common. 

I was able to shrink the params file that set the size of the arrays and get a working exe. but I need more mem soon for production runs. 

If there was a way to get a list of arrays and memory storage sizes associated with those, I can make a better plan of attack. Even if it told me which common blocks and sizes would be helpful.

Thanks for your help Dr. Fortran! you've been a great help for many years and glad you are still active here.

0 Kudos
Highlighted
Black Belt Retired Employee
89 Views

As I mentioned, a compiler listing file includes the sizes of all fixed-dimension arrays. Use the /list option or, in Visual Studio, Fortran > Output FIles > Source Listing. Here's an example:

Page 1           Source Listing                  _UNNAMED_MAIN$$
2019-11-22 14:22                                 t.f90

      1 real bigarray(10000)
      2 common /cmn/ bigarray
      3 end


ENTRY POINTS

  Name              
                    
 MAIN__             


SYMBOL CROSS REFERENCE

 Name                       Object Declared Type            Bytes Dimen Elements Attributes       References                        
                                                                                                                                    
 CMN                        Common 2                                    40000                                                       
 _UNNAMED_MAIN$$            Prog   1                                                                                                


TYPE COMPONENTS/COMMON VARIABLES

 Name                       Type            Bytes Offset   Dimen Elements Attributes       References                         
                                                                                                                              
 BIGARRAY                   R(4)            4     0        1     10000    COM                     

 

0 Kudos
Highlighted
89 Views

First rule of order in converting "legacy" programs into modern code is to:

1) Verify that all named COMMON /YourNameHere/ ... have the exact same variable names and orders. If (when) they differ you must be very careful that any changes (alteration) or removal from one do not adversely affect the other.

2) Find all use of EQUIVILANCE and, if possible, choose one of the names to be your primary name and then use ASSOCIATE to perform the name change in the other source files. *** note, do this also in the situation were a same named COMMON uses different namings.

Once you have that working (compiling and run tests certified) then continue modernizing.

>>I was able to shrink the params file that set the size of the arrays and get a working exe. but I need more mem soon for production runs. 
>>If there was a way to get a list of arrays and memory storage sizes associated with those, I can make a better plan of attack

Because you know the names of the params involved, and what sizes makes it work and what sizes fail, you can search the solution for uses of the params. Probably starting with the largest and working towards the lowest. And identify the arrays, and one by one make them allocatable, add code to allocate and initialize. *** Note, this may be a little more difficult for those arrays that have DATA... initialization, so those arrays could be left for last (these you would likely initialize via READ).

Jim Dempsey

0 Kudos