Ignore:
Timestamp:
12/01/21 16:52:24 (3 years ago)
Author:
ymipsl
Message:

tracking memory leak
Elements, views, and connectors are now managed with shared pointer.
YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_elements.cpp

    r1960 r2267  
    66{ 
    77 
    8   CGridLocalView* CGridLocalElements::getView(CElementView::type type) 
     8  shared_ptr<CGridLocalView> CGridLocalElements::getView(CElementView::type type) 
    99  {  
    10     if (views_[type]==nullptr) views_[type] = new CGridLocalView(this, type) ; 
     10    if (views_[type]==nullptr) views_[type] = make_shared<CGridLocalView>(shared_from_this(), type) ; 
    1111    return views_[type] ; 
    1212  } 
    1313   
    14   CGridLocalConnector* CGridLocalElements::getConnector(CElementView::type srcType, CElementView::type dstType, bool withMask) 
     14  shared_ptr<CGridLocalConnector> CGridLocalElements::getConnector(CElementView::type srcType, CElementView::type dstType, bool withMask) 
    1515  { 
    1616    auto newPair = pair<CElementView::type,CElementView::type>(srcType,dstType); 
     
    1818    if (it==connectors_.end())  
    1919    { 
    20       auto insertPair=pair<pair<CElementView::type,CElementView::type>, CGridLocalConnector*>(newPair,new CGridLocalConnector(this, srcType, dstType, withMask)) ; 
     20      auto insertPair=pair<pair<CElementView::type,CElementView::type>, shared_ptr<CGridLocalConnector>>(newPair, make_shared<CGridLocalConnector>(shared_from_this(), srcType, dstType, withMask)) ; 
    2121      it=connectors_.insert(insertPair).first ; 
    2222    } 
Note: See TracChangeset for help on using the changeset viewer.