"Out Of Memory" Message

Hi,

I have recently taken over responsibility for an application. I have been developing it for a while now and recently a change i made required me to add something to the list of "undos" that the program will do. This was the first time that i had done this. Its reasonably simple stuff, moving something and then undoing it or typing something and then undoing it. When an undo event is created its added to a stack and on some occasions information is saved to a file, which is temporary. Then when you wish to undo an event we run through the stack and pop each at a time. I'm sure this is basic undo stuff.

My problem is occasionally when using the application i undo something and receive an "Out of Memory" error. This I think is a system generated message, as all our undo stuff is contained within a try catch block. The annoying thing about this problem is its seems impossible to reproduce. you can do the same thing after restarting the application and still not reproduce it. Although if you dont restart the application you can reproduce it by with new documents. I was wondering if anyone could tell me if they have come across this problem and any possible solutions. Its driving me crazy lol!

Many thanks

Will



Answer this question

"Out Of Memory" Message

  • Allah Is Here

    I'm not sure whether this is the answer for your question.
    You can install a user function that is to be called when operator new fails in its attempt to allocate memory. This can be accomplished by using set_new_handler function.

    Please see MSDN for more information

    If you have some memory profilers (Like Numega Bounds Checker or Intel vTune Performance analyzer), please check it with that tool, it will show where you have a catch in your application.
    Check the memory consumed by your application with the help of Windows Task Manager or Tool like Process Explorer. If it constantly increasing without any reason, definitely there will have memory leak.



  • Pat J

    Hi,

    I have since found and solved the reason for this error message. The reason was a value that was saved as 0 was being read back in as 1056786045. I dont know why this happened in the first place, but the variable that should be set to 0 is used to in a call to SetSize of a CArray. This was the where the error was generated. I dont know what the limit is for CArrays but i'm sure it falls well before 1 billion ish. Thanks for your help though guys

    Will


  • Lars Brange

    The "Out of Memory" error is often used as a general failure that is unrelated to memory.

    So you need to determine the exact function that is issuing the error and the parameters used for it. When you determine that, the problem will likely be obvious. If not, then post the specifics for someone to help you with.

    This could be a symptom of some other problem that is more difficult to diagnose. Ensure that all error condtions are being caught; an "Out of Memory" error could be the result of bad data from a previous call. Also, it could be that memory is being clobbered. If memory is being clobbered, then that could explain the unpredictablility.


  • "Out Of Memory" Message