ATLAS Offline Software
Loading...
Searching...
No Matches
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
19using 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 :
42 ATH_CHECK( evtStore().retrieve() );
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
virtual StatusCode initialize() override
virtual StatusCode execute() override
Gaudi::Property< int > m_nbrLeaks
nbr of Leak objects
virtual ~LeakyAlg()
Destructor:
std::list< Leak * > m_leaks
container to hold the leaked objects
Gaudi::Property< int > m_leakSize
Property to setup the size of the leak.
PerfMonTestPolyVectorAlg.h Example for the memory optimization tutorial.