GUI_LANG_LoadCSVEx() causes memory leak

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

  • GUI_LANG_LoadCSVEx() causes memory leak

    Hi,

    I observed that repeated calls of GUI_LANG_LoadCSVEx() does NOT remove (free) ALL the previous used language resources.
    "Fixed Bytes" are not freed! Multiple calls of GUI_LANG_LoadCSVEx() increases the amount of "Fixed Bytes" successively until out of (emWin-)memory.

    Is this a bug, or am I doing something wrong?

    Best regards,
    Matz
  • I'm bothering to find out what I am doing wrong. I could not find anything. ?(
    emWinSPY shows "Fixed Bytes" increasing and "Free Bytes" shrinking, until error message "WM.c No memory ..." appears.

    Does it promise success to continue searching the fault in my software? Or is it on emWin side?
    Please help.

    If desired I can provide sample code for demonstration (based on emWin Sample "LANG_UTF8_CSV_TXT.c").
    Matz.
  • Hi Matz,

    I assume you are using the function GUI_LANG_GetTextEx() to access the text. Please note that ALL text returned by that function remains valid in any case. The function GUI_LANG_GetTextBufferedEx() does not allocate memory.

    Best 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.
  • Hi Jörg,

    Thanks for the reply. But sorry, I dont understand completely: ?(
    Scenario: what happens with internal resources (emwin-memory) when the csv file with GUI_LANG_LoadCSVEx() is opened again and the "same" text is accessed with GUI_LANG_GetTextEx ("same" means with identical IndexText and IndexLang)?

    You say: returned text remains valid in any(!) case. But if new text allocates additionally(!) memory - without freeing the memory of the old text, that makes no sense, because the old text (with same ID) can never be accessed anymore.

    emWin documentation promises (32.2.6.2 GUI_LAND_LoadCSVEx()): "This function call first deletes all existing text resources". And in this post: Memory Allocation (see last post) Adrian also confirmed this. But the observed behaviour is in contrast to that. Please check it to prevend a memory leak.

    Best regards.
    Matz.