in reply to Re^2: Why I got nearly out of memory, and never recover from that?
in thread Why I got nearly out of memory, and never recover from that?

To all above:

The most direct problem it caused is: it seems using hard disk prior than "true" memory, which caused the program runs rather slow. How could I improve it?
  • Comment on Re^3: Why I got nearly out of memory, and never recover from that?

Replies are listed 'Best First'.
Re^4: Why I got nearly out of memory, and never recover from that?
by Corion (Patriarch) on Jun 16, 2009 at 07:27 UTC

    You'll need to modify your program so it doesn't need as much memory at once.

Re^4: Why I got nearly out of memory, and never recover from that?
by JavaFan (Canon) on Jun 16, 2009 at 09:31 UTC
    The most direct problem it caused is: it seems using hard disk prior than "true" memory, which caused the program runs rather slow. How could I improve it?
    It's not surprising your program uses the disk a lot. In your original post, you say your program reads in a large file. Said file lives on disk. To get it from disk, it needs to use the disk. Hence the disk usage.

    Of course, it could also mean you're using so much memory the process is swapping to disk. In that case, you may want to look at your program again and see whether you really need to complete file in memory.