Archived

This topic is now archived and is closed to further replies.

CProgrammer

Exceeding memory

Recommended Posts

What happens if my application exceeds a computers memory capacities? Will the programm just crash or will windows give an apropriate error message? -CProgrammer

Share this post


Link to post
Share on other sites
Well, It is probably very hard to do (taking virtual memory into cosideration), but would probably give you an error message (unless your system became so unstable that it crashes).

Share this post


Link to post
Share on other sites
malloc returns 0. If you don''t check for that, it will probably crash. new will throw an exception. If you don''t catch that, it will crash.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
malloc will return a NULL pointer (cannot allocate) and the new operator will throw and exception when it cannot allocate.

The reasons are many fold as to why an allocation may fail, but the most common senario is out of memory.

If I remember correctly, Windows CE would issue a LOW_MEMORY message to the application via GetMessage function. However, functionality such as this is very uncommon and pretty much non existant on systems that support virtual memory.



Share this post


Link to post
Share on other sites
quote:
Original post by smart_idiot
I''m not sure what happens when you run out of stack space.

A structured exception is thrown on Win32 I believe.

Share this post


Link to post
Share on other sites