- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I used quite a lot allocatable arrays in my code. My problem is as follow:
I know for Win2K Professional version, the largest memory can be used for each application is about 1.75G (about 1792M?). Before I want to allocate a large 2-dim array, I checked the memory left. Then I calculated the largest dimensions for that array. I can guarantee my calculation is correct and it should allow me to allocate the array. However, I still have the problem to allocate the space.
The run-time error is 41, which indicates there is no enough virtual memory. However, from information from the code, I have so much memory to use for the array.
Is that due to memory leakage? If so, it should still be OK since I just checked the memory before allocating. Or maybe each allocate command requires some extra memory? I am confused. Any help would be appreciated.
SOme additional info:
OS: Win2K Prof. SP3
Compiler: Comapq Visual Fortran 6.6
It is a console application.
I know for Win2K Professional version, the largest memory can be used for each application is about 1.75G (about 1792M?). Before I want to allocate a large 2-dim array, I checked the memory left. Then I calculated the largest dimensions for that array. I can guarantee my calculation is correct and it should allow me to allocate the array. However, I still have the problem to allocate the space.
The run-time error is 41, which indicates there is no enough virtual memory. However, from information from the code, I have so much memory to use for the array.
Is that due to memory leakage? If so, it should still be OK since I just checked the memory before allocating. Or maybe each allocate command requires some extra memory? I am confused. Any help would be appreciated.
SOme additional info:
OS: Win2K Prof. SP3
Compiler: Comapq Visual Fortran 6.6
It is a console application.
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How do you "check the memory left"? Keep in mind that allocation requires that there be a contiguous, unallocated segment of virtual memory available. Yes, each allocate has a small amount of overhead for tracking data, but this is generally not a problem.
How close can you get to your computed maximum?
Steve
How close can you get to your computed maximum?
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I used the function call "getmemstat" for available memory virtual before allocation. For a 32-bit application, the usable virtual memory is about 1.75G (actually for a small testing program, it is about 1.8G I tested). Before anything, the available virtual memory I got is about 2G, I can easily set the difference (d) as about 0.25G, which is not usable. So before I allocate, I call "getmemstat" to get current available virtual memory, then substract d from it. I use this substracted number as the base to compute the maximum.
However sometimes I cannot use as much as 1.7G virtual memory for my application.
> How do you "check the memory left"? Keep in mind that
> allocation requires that there be a contiguous,
> unallocated segment of virtual memory available.
> Yes, each allocate has a small amount of overhead
> for tracking data, but this is generally not a
> problem.
>
> How close can you get to your computed maximum?
>
> Steve
However sometimes I cannot use as much as 1.7G virtual memory for my application.
> How do you "check the memory left"? Keep in mind that
> allocation requires that there be a contiguous,
> unallocated segment of virtual memory available.
> Yes, each allocate has a small amount of overhead
> for tracking data, but this is generally not a
> problem.
>
> How close can you get to your computed maximum?
>
> Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The error is coming from the Win32 API routine we use to allocate the memory. (Depending on the allocation size, we may use a Win32 call or a C library call.)
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for all the information.
Will that be fixed in near future such as a patch?
> The error is coming from the Win32 API routine we use
> to allocate the memory. (Depending on the allocation
> size, we may use a Win32 call or a C library call.)
>
> Steve
Will that be fixed in near future such as a patch?
> The error is coming from the Win32 API routine we use
> to allocate the memory. (Depending on the allocation
> size, we may use a Win32 call or a C library call.)
>
> Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The "fix" would be to move to an operating system that supports more than 2Gb of user addressable virtual memory space. Either one of the 32 bit Windows line that supports the /3Gb switch or a 64 bit OS.
James
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When I said "the error" I meant the failure status - I did not mean to imply that there is a bug in the software. CVF just returns what it Windows tells it in this case.
Steve
Steve
![](/skins/images/B7BA37F9CE4B52FF7CAE1FB0388839C8/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page