memory leak when following game engine tutorial

  • rubberduck
    Likes 0

    Problem Description

    Hello, i have encountered a lot of memory leaks detected when I run the application. Would appreciate any advice given thank you 

  • rubberduck
    Likes 0

    solved: unique ptrs were not reset and cleared properly when sf::event::closed in handleInput() 

  • hinddcluum
    Likes 0

    Sure! Here’s a concise list to address memory leaks:

    1. **Use a Memory Profiler**: Tools like Valgrind or built-in IDE profilers can help track memory usage.
    2. **Review Code**: Check for unreleased resources, circular references, and event listeners.
    3. **Static Code Analysis**: Use tools to identify potential leaks in your code.
    4. **Test for Leaks**: Simulate long-running conditions to monitor memory usage.
    5. **Regular Code Reviews**: Get peers to review your memory management practices.
    6. **Document Ownership**: Clearly define the lifecycle of objects.
    7. **Automated Checks**: Integrate memory checks in your CI/CD pipeline.

    Let me know if you need more details on any point!

Login to reply