- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
{
return TRUE;
}
If I call this function in my Fortran program, and use
ifort testlarge.f entestf.f reg.lib
The generated testlarge.exe can only allocate 161M-element array, occupying only 1.288 GB!
Do you know why there is a discount of the memory usage?
Please note that this test is done in a Pentium 4 machine with 1 GB or 2 GB memory.
Message Edited by jingz on 07-25-2005 09:07 AM
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
complex
A(248000000) ! Does this mean(+ fudge)?and call GetId later, itworks.
However, I need to dinamically allocate the array. If I use
complex A(:) allocatable :: A...
allocate
(A(170000000))call
GetIdItdeos NOT work.
I need to allocate the array dynamically in my program. Why is dynamic allocation even worse?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
real bigarray(*)
pointer (p_bigarray, bigarray)
p_bigarray = malloc (number_of_elements*4)
This will use C's malloc (indirectly) and you should not get the pool fragmentation. Maybe. You can now refer to bigarray normally, though you don't get bounds checking.
I will comment that pushing the 2GB limit can cause unpredictable results - your program may work on some systems and not others, or work one day and not another. It all depends on what else is loaded into your address space by Windows.
You may also want to experiment with the order in which you do the allocations, which may make a difference.
Or consider using the Win32 API VirtualAlloc for both C and Fortran.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
real(8), allocatable :: dummy(:)
program YourProgramName
! in beginning of program before any other calls
! e.g. first execuitable line in main
allocate(dummy(248000000+256))
call InitializeProgram ! Including Getting Array Size
... ! other startup but pre-allocation code
! Now allocate big honk'n array to BigHonknSize
deallocate(dummy) ! free up humoungous memory block
allocate(A(BigHonknSize))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page