Software Archive
Read-only legacy content
17061 Discussions

Dynamic Memory Management

Intel_C_Intel
Employee
245 Views
I am developing a large scientific simulation program which needs a huge amount of memory - sometimes up to 1.8 GByte. The Fortran main subroutine calls a C function which allocates the required memory using the standard malloc() function of the C runtime system. Unfortunately it is impossible to allocate more than 1.25 GByte within this program. The size of the executable is about 20 MByte and the size of the .bss and .data segments are about 8 MByte. Therefore I think it should be possible to allocate much more than these 1.25 GByte.

Pure C programs and also small Fortran programs get about 1.9 GByte, so I think that the Fortran runtime system reserves some memory in its startup code.

Does anyone come across this behaviour before or does anyone have a solution or a workaround for this problem ? Maybe there are some compiler or linker flags I do not know.

Thanks, Arne
0 Kudos
2 Replies
Steven_L_Intel1
Employee
245 Views
You're pushing the limit of the total addressable space under Windows. Fortran does not "reserve" memory - it does allocate some if you open files, and, of course, if you use ALLOCATE. Linker settings won't help here. I think malloc may have some internal limits - you might try VirtualAlloc instead.

Steve
0 Kudos
Intel_C_Intel
Employee
245 Views
OD, I spent some additional hours in debugging the application and found out the the memory is not allocated by the Fort ran run time system but by the OpenGl libraries of Windows 2000. Just one single call to an OpenGl function (e.g. hdc = wglGetCurrentDC()) is enough to load the libraries which allocate about 500 BB of memory.

Thanks, Are
0 Kudos
Reply