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

Introduce TrilinosWrappers::make_rcp(...). #16202

Closed
bangerth opened this issue Oct 27, 2023 · 4 comments
Closed

Introduce TrilinosWrappers::make_rcp(...). #16202

bangerth opened this issue Oct 27, 2023 · 4 comments
Milestone

Comments

@bangerth
Copy link
Member

Looking at #16156, we are introducing a number of places again where we're using bare operator new calls. We've tried to replace as many of these by std::make_shared() and std::make_unique() as possible in recent years to make it easier to reason about whether a piece of code may or may not have memory leaks. We should create a function

template<class T, class... Args>
Teuchos::RCP<T>
make_rcp(Args&&... args)
{
    return Teuchos::RCP<T>(new T(std::forward<Args>(args)...));
}

and use it wherever we allocate memory via direct new calls right now.

(Of course, it would be nice if Teuchos already had such a function for us, but I can't find one.)

@kinnewig FYI.

@bangerth bangerth added this to the Release 9.6 milestone Oct 27, 2023
@maartenarnst
Copy link

There is such a function :)

@bangerth
Copy link
Member Author

@maartenarnst Nice! Do you happen to know which release this was introduced in?

@maartenarnst
Copy link

The PR with this function was merged in June 2022. It was during a period in which the Trilinos team seems to have updated the version number less frequently. The earliest version in which this PR is included seems to be 14.0 from May 2023.

@bangerth
Copy link
Member Author

Fixed by #16270.

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

No branches or pull requests

2 participants