Skip to content

ATLASRECTS-6281 : Surface, try to solve memory leaks when passing naked pointers to transforms.

Surface, try to solve memory leaks when passing naked pointers to transforms.

The issue is that in places when we pass plain ptr

foo(Amg::Transform* ptr)

we were doing

std::make_unique<Amg::Transform> (*ptr)

rather than wrapping

std::unique_ptr<Amg::Transform> (ptr)

Adding const reference ctors on top of unique_ptr.

In reality as things stand except if a caller really pass nullprt tranform in which case the default ctor could have been used ... There is no real need to all these memory allocation ... are there due to clients doing them.

We prb need to keep ref and if things can be nullptr the unique_ptr ones, and remove the plain ptr transforms ...

@sroe this should address the issue more or less.

The real long term fix is to removed the naked ptr one as much as we can. And replace with value ones as much as we can.

I think in a lot of cases we never pass nullptr e.g the full things is a bit weird to be a ptr of any kind.

Edited by Christos Anastopoulos

Merge request reports