Skip to content
This repository was archived by the owner on Sep 18, 2022. It is now read-only.

Conversation

@MalekiRe
Copy link
Contributor

@MalekiRe MalekiRe commented Apr 19, 2022

From not destroying renderer. And not destroying wlr_surface.

@MalekiRe MalekiRe changed the title Fixed large memory leak Fixed large and smallish memory leak Apr 19, 2022
@philpax
Copy link

philpax commented Apr 21, 2022

It looks like the resources you're cleaning up in the destructor are pointers, so you can use a unique_ptr with a custom deleter: https://stackoverflow.com/questions/19053351/how-do-i-use-a-custom-deleter-with-a-stdunique-ptr-member

This saves you from implementing the destructor yourself, and maaaaay help in the case of partial initialisation (but don't quote me on that)

@technobaboo
Copy link
Collaborator

How can I ensure they all get destroyed in the right order @philpax?

@philpax
Copy link

philpax commented Apr 21, 2022

The destruction order is in reverse order of declaration: https://stackoverflow.com/questions/29168162/destruction-order-of-class-data-members

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants