Reputation: 117
When will a program get an 'Out of memory exception'. Is it when not having enough virtual address range or because of not having enough physical memory?
As per my understanding, it should happen only when not enough virtual address is available as physical storage can be made available by paging un-used sections.
Please clarify.
Thanks, Suresh.
Upvotes: 2
Views: 744
Reputation: 75336
If you're seeing an OutOfMemoryException
, this is presumably a .Net application. Ironically, the conditions you describe are pretty much never the source of an OutOfMemoryException
in .Net.
In most cases, it's better to think of an OutOfMemoryException
as being an OutOfSomeCriticalResourceButNotRAMIronicallyEnoughException
. Or even worse: as one example, .Net throws an OutOfMemoryException
when you attempt to open an invalid image file.
Upvotes: 2
Reputation: 54168
Total memory available = physical (RAM) plus page file(s).
When both are full, you get the exception on any further memory allocation requests.
On some systems this is qualified further by the fact that the kernel reserves a portion of physical RAM for itself, so user mode programs are left to compete for the rest.
Upvotes: 1
Reputation: 499132
When you run out of addressable space for the program to access. This normally means virtual address range, but if you have enough RAM, it would be the physical memory.
Upvotes: 0