Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use placement new and explicit destructor for tf #222

Merged
merged 5 commits into from
Mar 29, 2023
Merged

Conversation

umireon
Copy link
Member

@umireon umireon commented Mar 29, 2023

This ensures cv::Mat will be allocated and freed properly.

@umireon umireon changed the title Use placement new and explicit destructor Use placement new and explicit destructor for tf Mar 29, 2023
Copy link
Collaborator

@royshil royshil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i much prefer that we use smart pointers like a std::unique_ptr

can you consider that?

@umireon
Copy link
Member Author

umireon commented Mar 29, 2023

OBS requires us to return void* pointer for data so we cannot use unique_ptr for tf.
Additionally, unique_ptr won't work correctly when the constructor and the destructor of the container struct are not called.
I don't think unique_ptrs on struct background_removal_filter are released when the filter is destroyed.
We have to call the constructor and the destructor of struct background_removal_filter.

Copy link
Collaborator

@royshil royshil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK i guess this is fine.

but are we releasing the bmalloc somwhere?

@umireon
Copy link
Member Author

umireon commented Mar 29, 2023

Releasing here and calling the destructor.
7102c6a#diff-4e873e25a59f1bf23600cc652a834a24cb84ecf53e865840736f921b5f7a0160R319-R320

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants