- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there
I'm writing a code that does some heavy structural computations; usually ituses a double precision complexarraymade of 2048x512x25 elements. The array is declared allocatable, the program allocate it justbefore using it, and deallocate it before exiting.
1) If I try to allocate a larger array, say 2048x1024x25, I get an out of memory error. Is there a way to make Fortran working with larger arrays automatically using hard disk free space as a temporary memory? Or I have to rewrite the codeand manually include some instructions for writingscratch files?
2) I've noticed that after the program successfully exit my pc becamesextremely slow, and I've to reboot to make it run again at normal speed. Is it because the program doesn't free all the occupied memory at exit? Or what else? Is there a way to avoid to reboot every time? Notice that this happens not only on my pc, I get same behaviour on other 2 machines.
thank you in advance for the suggestion
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your array is about 400+ Megabytes in size. If you don't have that much free RAM, the OS is going to automatically use virtual memory, which is a tantalising mix of very fast RAM and very slow disk. While RAM speeds have gone up to the nanosecond speed range, disks are still limited to like 20 milliseconds worst case. That's a difference of like a million or more, so yes, things can get ridiculously slow when virtual memory kicks in..
The OS frees all your program memory when the program exits, unless you've done some very advanced API calls to allocate global shareable memory, which you probablya re not.
The reason the OS seems so slow is your 400MB array pushed out a lot of system code and cached disk blocks. When I do this my computer also slows to a crawl, and it makes many minutes for the RAM to get refilled by stuff I really need, like the desktop, explorer, browser, and all open files. You shouldnt need to reboot.
I'd go out and buy a couple 1GB memory sticks, about $89 each. Like they say about cubic inches in car engines, there's no substitute for actual RAM.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the answer... and for the quickness!!!
Then I'm going to boost up the displacement of my car, ehm, the RAM of my pc...
Just one more question:
If the OS automatically puts on disk everything exceeding the free RAM space, why I get an out of memory error if I make the arrays too large?Shouldn't it works in thesame way if Iallocate a 2 Gb array or more?
- 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
![](/skins/images/C4F7392A5C68ACA60290C9576F107044/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page