ATLAS Offline Software
PerfMonTestLeakyAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // PerfMonTestLeakyAlg.cxx
6 // Implementation file for class PerfMonTest::LeakyAlg
7 // Author: S.Binet<binet@cern.ch>
9 
10 
11 // STL includes
12 
13 // FrameWork includes
14 #include "Gaudi/Property.h"
15 
16 // PerfMonTests includes
17 #include "PerfMonTestLeakyAlg.h"
18 
19 using namespace PerfMonTest;
20 
21 
22 // Destructor
25 {
26  ATH_MSG_DEBUG ( "Calling destructor" ) ;
27  // finally deleting our leaked objects...
28  for ( std::list<Leak*>::iterator i = m_leaks.begin(), iEnd = m_leaks.end();
29  i != iEnd;
30  ++i ) {
31  delete *i; *i = 0;
32  }
33 }
34 
35 // Athena Algorithm's Hooks
38 {
39  ATH_MSG_INFO ( "Initializing " << name() << "..." ) ;
40 
41  // Get pointer to StoreGateSvc and cache it :
43 
44  return StatusCode::SUCCESS;
45 }
46 
47 
49 {
50  ATH_MSG_DEBUG ( "Executing " << name() << "..." ) ;
51 
52  if ( 0 == m_leakSize ) {
53  return StatusCode::SUCCESS;
54  }
55 
56  for ( int ileak = 0; ileak < m_nbrLeaks; ++ileak) {
57  Leak * leak = new Leak;
58  leak->m_data.reserve( m_leakSize );
59  for ( std::size_t i = 0; i != static_cast<std::size_t>(m_leakSize); ++i ) {
60  leak->m_data.push_back( i );
61  }
62 
63  m_leaks.push_back( leak );
64  }
65 
66  return StatusCode::SUCCESS;
67 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
PerfMonTest::LeakyAlg::m_leakSize
Gaudi::Property< int > m_leakSize
Property to setup the size of the leak.
Definition: PerfMonTestLeakyAlg.h:49
PerfMonTest::LeakyAlg::m_leaks
std::list< Leak * > m_leaks
container to hold the leaked objects
Definition: PerfMonTestLeakyAlg.h:59
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
PerfMonTest::LeakyAlg::m_nbrLeaks
Gaudi::Property< int > m_nbrLeaks
nbr of Leak objects
Definition: PerfMonTestLeakyAlg.h:56
PerfMonTest::LeakyAlg::initialize
virtual StatusCode initialize() override
Definition: PerfMonTestLeakyAlg.cxx:37
PerfMonTestLeakyAlg.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
PerfMonTest
PerfMonTestPolyVectorAlg.h Example for the memory optimization tutorial.
Definition: Control/PerformanceMonitoring/PerfMonTests/src/Hit.h:7
PerfMonTest::LeakyAlg::Leak::m_data
std::vector< int > m_data
Definition: PerfMonTestLeakyAlg.h:52
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
PerfMonTest::LeakyAlg::execute
virtual StatusCode execute() override
Definition: PerfMonTestLeakyAlg.cxx:48
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
PerfMonTest::LeakyAlg::Leak
Definition: PerfMonTestLeakyAlg.h:51
PerfMonTest::LeakyAlg::~LeakyAlg
virtual ~LeakyAlg()
Destructor:
Definition: PerfMonTestLeakyAlg.cxx:24