← Back to team overview

kicad-developers team mailing list archive

Re: [Patch] Fix some memory leaks

 

On 2019-08-13 10:50, Wayne Stambaugh wrote:
On 8/13/19 2:13 AM, jp charras wrote:
Le 12/08/2019 à 21:54, Wayne Stambaugh a écrit :
Sounds like a plan. If there are not bug reports against this over the
next month, I'll will cherry-pick it into 5.1.

Wayne

I am not sure this issue exists in 5.1.

AFAIK it comes from moving code from our DLIST to std::deque, only in
master branch.

Our DLIST dtor manages (when it has the ownership) the items deletion.
But std::deque does not delete the items, so the code using std::deque
has to delete these items.

Maybe we should have used boost::ptr_deque instead.  You get heap
allocation cleanup for free.

We can adjust between containers now if desired as long as they obey the std::random_access_iterator constraints. The major work in moving from DLIST was removing all the places where we assumed the element was itself a list.

For now, I prefer keeping the single list cleanup in the board dtor until we have a standardized python interface that doesn't expose our internals. After we abstract the python interface, I see no reason why we wouldn't utilize std::unique_ptr as Simon suggested.

-Seth


References