Skip to content

Memory leak #4

@alexydens

Description

@alexydens

When you create your scene, you use C++'s builtin 'new' operator. This allocates heap memory, which must be freed. At the end of the program, you do not clean up your resources for the scene. This is a memory leak. You need to call 'delete' on the loading scene and the game scene, otherwise this memory is never freed. There may be more memory leaks, I haven't looked. Please deallocate your resources after you use them. If you want to abstract away the details of how memory is managed for your scene objects, you can use smart pointers such as unique_ptr() and shared_ptr() to manage refrence counting or scope to deal with lifetimes. This way, memory is not left unfreed after the program has finished running.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions