Memory Allocation Failures
-
I am running into the case where the system is running our of memory so new and malloc are returning 0 causing our application to crash. Of course windows is totally hosed at this point as well (it doesn't handle out of memory situations very well). Checking for allocation failures everywhere would be huge task and I am concerned that it would not add much value. What do you guys do about this? Do you actually check for failures and handle them? If so, how do you handle them? Thanks! Chris PS - I have setup a new handler with a safety buffer to ensure that I have enough memory to display a warning message to allow the user to logout, but this is till not good enough.
-
I am running into the case where the system is running our of memory so new and malloc are returning 0 causing our application to crash. Of course windows is totally hosed at this point as well (it doesn't handle out of memory situations very well). Checking for allocation failures everywhere would be huge task and I am concerned that it would not add much value. What do you guys do about this? Do you actually check for failures and handle them? If so, how do you handle them? Thanks! Chris PS - I have setup a new handler with a safety buffer to ensure that I have enough memory to display a warning message to allow the user to logout, but this is till not good enough.
Chris Hafey wrote: Do you actually check for failures and handle them? yes. Chris Hafey wrote: If so, how do you handle them? all of my apps use a common error code system, so i just return the appropriate error code. eventually that error will work its way back to the UI, which will give the user a nice message box. -c
Though the cough, hough and hiccough so unsought would plough me through, enough that I o'er life's dark lough my thorough course pursue. --Stuart Kidd
-
I am running into the case where the system is running our of memory so new and malloc are returning 0 causing our application to crash. Of course windows is totally hosed at this point as well (it doesn't handle out of memory situations very well). Checking for allocation failures everywhere would be huge task and I am concerned that it would not add much value. What do you guys do about this? Do you actually check for failures and handle them? If so, how do you handle them? Thanks! Chris PS - I have setup a new handler with a safety buffer to ensure that I have enough memory to display a warning message to allow the user to logout, but this is till not good enough.
Chris Hafey wrote: Checking for allocation failures everywhere would be huge task and I am concerned that it would not add much value. Your concerns are unfounded. However, people using your software should be really concerned. You are excercising very dangerous practices. I hope you very soon learn the errors of your ways before you hurt anyone but yourself... What do you guys do about this? Check every single allocation. Do you actually check for failures and handle them? Are you trolling, or is it that you really don't know?! Of course you have to check for failures! If so, how do you handle them? In the appropriate way. There's no way to know how your application should handle failures. If not even you, the developer, know what to do in case of a failure in your own application... I'm speechless. Would you mind telling us the name of this application? Using it would be like juggling with handgrenades with the safety off, and I sure don't want to come anywhere near it.