How to detect a memory allocation problem

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • How to detect a memory allocation problem

    During developing I noticed something strange in the behaviour of emWin libraries. Finally I resolved the problem increasing the amount of memory to emWin through GUI_ALLOC_AssignMemory(). I think there were some memory allocation errors, but it wasn't clear to me.

    So my question: is it possible to trigger an error (such as an assertion) when a memory allocation failed?
  • Hi,

    If GUI_DEBUG_LEVEL is >= 4 the memory allocation module generates a warning:

    if ((U32)Size > GUI_ALLOC__Context.NumFreeBytes) {
    GUI_DEBUG_WARN("GUI_Alloc.c:\nNot enough memory available in _Alloc().");
    return 0;
    }

    More information can be found in the documentation under GUI_X_ErrorOut(), GUI_X_Warn() and GUI_X_Log().

    Regards, Jörg
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.