Skip to main content
Associate
June 26, 2024
Solved

Out of memory error.lwip

  • June 26, 2024
  • 1 reply
  • 1867 views

Good evening everyone; I was going to ask about something the size of it. If anyone has any information, I'd be happy. STMCube ide is also the LWip library tool. For MQTT connection via Ethernet. After publishing and subscribing for a certain period of time (30-40 minutes), "Out of memory error." (-1) error occurs and publishing and subscribing operations stop. How can I do that.

    Best answer by Andrew Neil

    You're going to need to give a lot more detail!

    https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228

     


    @ramazan_kavak wrote:

    "Out of memory error." (-1) error occurs 


    Where, exactly, does it occur?

     


    @ramazan_kavak wrote:

     After publishing and subscribing for a certain period of time (30-40 minutes)


    Sounds like you have a memory leak - ie, you keep allocating memory, but never release it.

    You need to review your code (maybe also the LwIP documentation, and documentation for your MQTT library) to see where memory is being allocated, and check that it always gets released (de-allocated).

    1 reply

    Andrew Neil
    Andrew NeilBest answer
    Super User
    June 26, 2024

    You're going to need to give a lot more detail!

    https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228

     


    @ramazan_kavak wrote:

    "Out of memory error." (-1) error occurs 


    Where, exactly, does it occur?

     


    @ramazan_kavak wrote:

     After publishing and subscribing for a certain period of time (30-40 minutes)


    Sounds like you have a memory leak - ie, you keep allocating memory, but never release it.

    You need to review your code (maybe also the LwIP documentation, and documentation for your MQTT library) to see where memory is being allocated, and check that it always gets released (de-allocated).

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    Associate
    November 20, 2024

    Hello, the problem in question still persists, most likely there is a memory leak as you said. So how do I free the allocated areas in memory? By clearing the buffers with memset? Can you examine the function blocks I publish and subscribe to?

    Andrew Neil
    Super User
    November 21, 2024

    @ramazan_kavak wrote:

    the problem in question still persists?


    So why have you marked it as solved?

    You can un-mark the solution:

    https://community.st.com/t5/community-guidelines/help-others-to-solve-their-issues/ta-p/575256#:~:text=If%20you%20accidentally%20chose%20the%20wrong%20post%20as%20solution%2C%20you%20can%20always%20revert%20this%20action%20by%20clicking%20%22Not%20the%20Solution%22

     


    @ramazan_kavak wrote:

     most likely there is a memory leak as you said. 


    First, you need to confirm that for sure

     


    @ramazan_kavak wrote:

     So how do I free the allocated areas in memory? 


    You need to identify where, exactly, that memory is being allocated, and why it is not getting freed.

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.